Add new optional field usershort to rcs_recentchanges.
authorJoey Hess <joey@kitenet.net>
Wed, 23 Jun 2010 19:32:27 +0000 (15:32 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 23 Jun 2010 19:54:52 +0000 (15:54 -0400)
Now the git plugin supports commits with author fields that look like:
Author: http://my.openid/ <me@web>

Then in recentchanges, the short username will be displayed, linking
to the openid.

Particularly useful for the horrible google openids, of course.

IkiWiki/Plugin/git.pm
IkiWiki/Plugin/recentchanges.pm
debian/changelog
doc/plugins/write.mdwn

index 222692eda6ad4dacb3c901e8ba53f4310c75c89d..a43b8592048a54d0e9cd91565bb95f5d4510ab3c 100644 (file)
@@ -342,8 +342,9 @@ sub parse_diff_tree ($) {
                        $ci{ "${who}_epoch" } = $epoch;
                        $ci{ "${who}_tz"    } = $tz;
 
-                       if ($name =~ m/^[^<]+\s+<([^@>]+)/) {
-                               $ci{"${who}_username"} = $1;
+                       if ($name =~ m/^([^<]+)\s+<([^@>]+)/) {
+                               $ci{"${who}_name"} = $1;
+                               $ci{"${who}_username"} = $2;
                        }
                        elsif ($name =~ m/^([^<]+)\s+<>$/) {
                                $ci{"${who}_username"} = $1;
@@ -588,9 +589,14 @@ sub rcs_recentchanges ($) {
                        push @messages, { line => $line };
                }
 
-               my $user=$ci->{'author_username'};
+               my $user=$ci->{'author_name'};
+               my $usershort=$ci->{'author_username'};
                my $web_commit = ($ci->{'author'} =~ /\@web>/);
-               
+
+               if ($usershort =~ /:\/\//) {
+                       $usershort=undef; # url; not really short
+               }
+
                # compatability code for old web commit messages
                if (! $web_commit &&
                      defined $messages[0] &&
@@ -603,6 +609,7 @@ sub rcs_recentchanges ($) {
                push @rets, {
                        rev        => $sha1,
                        user       => $user,
+                       usershort  => $usershort,
                        committype => $web_commit ? "web" : "git",
                        when       => $when,
                        message    => [@messages],
index e546e4702b43bda681e74996a51bcc6e6e3c0499..9f188cbffab91b626f3f61ba6ad5b123ed492a30 100644 (file)
@@ -114,12 +114,11 @@ sub store ($$$) {
        ];
        push @{$change->{pages}}, { link => '...' } if $is_excess;
 
-       # See if the committer is an openid.
        $change->{author}=$change->{user};
        my $oiduser=eval { IkiWiki::openiduser($change->{user}) };
        if (defined $oiduser) {
                $change->{authorurl}=$change->{user};
-               $change->{user}=$oiduser;
+               $change->{user}=defined $change->{usershort} ? $change->{usershort} : $oiduser;
        }
        elsif (length $config{cgiurl}) {
                $change->{authorurl} = IkiWiki::cgiurl(
index 03204134625f428936da3b25c494b23138e3745e..01d0abb47b9b2c87910e3c3cf3d069fccacfaa2b 100644 (file)
@@ -1,3 +1,9 @@
+ikiwiki (3.20100624) UNRELEASED; urgency=low
+
+  * Add new optional field usershort to rcs_recentchanges.
+
+ -- Joey Hess <joeyh@debian.org>  Wed, 23 Jun 2010 15:30:04 -0400
+
 ikiwiki (3.20100623) unstable; urgency=low
 
   * openid: Add openid_realm and openid_cgiurl configuration options,
index 1930055658b93a245cecff2cf5114fe882a065d5..5f0e95a9fe8bd3089a6a8dd717ae0afc981514ea 100644 (file)
@@ -1103,7 +1103,9 @@ The data structure returned for each change is:
 
        {
                rev => # the RCSs id for this commit
-               user => # name of user who made the change,
+               user => # user who made the change (may be an openid),
+               usershort => # short name of user (optional; not an openid),
+               
                committype => # either "web" or the name of the rcs,
                when => # time when the change was made,
                message => [