Renamed usershort => nickname.
Note that this means existing user login sessions will not have the nickname
recorded, and so it won't be used for those.
if (defined $oiduser) {
# looks like an OpenID
$commentauthorurl = $commentuser;
- $commentauthor = $oiduser;
+ $commentauthor = (defined $params{nickname} && length $params{nickname}) ? $params{nickname} : $oiduser;
$commentopenid = $commentuser;
}
else {
my $content = "[[!comment format=$type\n";
- # FIXME: handling of double quotes probably wrong?
if (defined $session->param('name')) {
my $username = $session->param('name');
$username =~ s/"/"/g;
$content .= " username=\"$username\"\n";
}
+ if (defined $session->param('nickname')) {
+ my $nickname = $session->param('nickname');
+ $nickname =~ s/"/"/g;
+ $content .= " nickname=\"$nickname\"\n";
+ }
elsif (defined $session->remote_addr()) {
my $ip = $session->remote_addr();
if ($ip =~ m/^([.0-9]+)$/) {
push @messages, { line => $line };
}
- my $user=$ci->{'author_name'};
- my $usershort=$ci->{'author_username'};
+ my $user=$ci->{'author_username'};
my $web_commit = ($ci->{'author'} =~ /\@web>/);
-
- if ($usershort =~ /:\/\//) {
- $usershort=undef; # url; not really short
+ my $nickname;
+
+ # Set nickname only if a non-url author_username is available,
+ # and author_name is an url.
+ if ($user !~ /:\/\// && defined $ci->{'author_name'} &&
+ $ci->{'author_name'} =~ /:\/\//) {
+ $nickname=$user;
+ $user=$ci->{'author_name'};
}
# compatability code for old web commit messages
push @rets, {
rev => $sha1,
user => $user,
- usershort => $usershort,
+ nickname => $nickname,
committype => $web_commit ? "web" : "git",
when => $when,
message => [@messages],
$vident->signed_extension_fields('http://openid.net/srv/ax/1.0'),
);
}
- my $username;
+ my $nickname;
foreach my $ext (@extensions) {
foreach my $field (qw{value.email email}) {
if (exists $ext->{$field} &&
defined $ext->{$field} &&
length $ext->{$field}) {
$session->param(email => $ext->{$field});
- if (! defined $username &&
+ if (! defined $nickname &&
$ext->{$field}=~/(.+)@.+/) {
- $username = $1;
+ $nickname = $1;
}
last;
}
if (exists $ext->{$field} &&
defined $ext->{$field} &&
length $ext->{$field}) {
- $username=$ext->{$field};
+ $nickname=$ext->{$field};
last;
}
}
}
- if (defined $username) {
- $username=~s/\s+/_/g;
- $session->param(username => $username);
+ if (defined $nickname) {
+ $nickname=~s/\s+/_/g;
+ $session->param(nickname => $nickname);
}
}
else {
my $oiduser=eval { IkiWiki::openiduser($change->{user}) };
if (defined $oiduser) {
$change->{authorurl}=$change->{user};
- $change->{user}=defined $change->{usershort} ? $change->{usershort} : $oiduser;
+ $change->{user}=defined $change->{nickname} ? $change->{nickname} : $oiduser;
}
elsif (length $config{cgiurl}) {
$change->{authorurl} = IkiWiki::cgiurl(
ikiwiki (3.20100624) UNRELEASED; urgency=low
- * API: Add new optional field usershort to rcs_recentchanges.
+ * Changes to avoid display of ugly google openids, by displaying
+ a username taken from openid.
+ * API: Add new optional field nickname to rcs_recentchanges.
* API: rcs_commit and rcs_commit_staged are now passed named
parameters.
+ * openid: Store nickname based on username or email provided from
+ openid provider.
+ * git: Record the nickname from openid in the git author email.
+ * comment: Record the username from openid in the comment page.
* Fixed some confusion and bugginess about whether
rcs_getctime/rcs_getmtime were passed absolute or relative filenames.
- * git: Record the username from openid in the git author email.
- (This avoids display of ugly google openids.)
-- Joey Hess <joeyh@debian.org> Wed, 23 Jun 2010 15:30:04 -0400
nearly any format, since it's parsed by [[!cpan TimeDate]]
* `username` - Used to record the username (or OpenID)
of a logged in commenter.
+* `nickname` - Name to display for a logged in commenter.
+ (Optional; used for OpenIDs.)
* `ip` - Can be used to record the IP address of a commenter,
if they posted anonymously.
* `claimedauthor` - Records the name that the user entered,
{
rev => # the RCSs id for this commit
user => # user who made the change (may be an openid),
- usershort => # short name of user (optional; not an openid),
+ nickname => # short name for user (optional; not an openid),
committype => # either "web" or the name of the rcs,
when => # time when the change was made,