From f4e69ed815ca65f38ee9d19219f33dabeb92b97e Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Thu, 18 Dec 2008 19:56:36 +0000
Subject: _comment directive: if the user looks like an OpenID, store that
---
IkiWiki/Plugin/comments.pm | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index c50729a34..336ed1a82 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -151,11 +151,28 @@ sub preprocess {
my $commentip;
my $commentauthor;
my $commentauthorurl;
+ my $commentopenid;
if (defined $params{username}) {
$commentuser = $params{username};
- ($commentauthorurl, $commentauthor) =
- linkuser($params{username});
+
+ my $oiduser = eval { IkiWiki::openiduser($commentuser) };
+
+ if (defined $oiduser) {
+ # looks like an OpenID
+ $commentauthorurl = $commentuser;
+ $commentauthor = $oiduser;
+ $commentopenid = $commentuser;
+ }
+ else {
+ $commentauthorurl = IkiWiki::cgiurl(
+ do => 'commenter',
+ page => (length $config{userdir}
+ ? "$config{userdir}/$commentuser"
+ : "$commentuser"));
+
+ $commentauthor = $commentuser;
+ }
}
else {
if (defined $params{ip}) {
@@ -165,6 +182,7 @@ sub preprocess {
}
$pagestate{$page}{comments}{commentuser} = $commentuser;
+ $pagestate{$page}{comments}{commentopenid} = $commentopenid;
$pagestate{$page}{comments}{commentip} = $commentip;
$pagestate{$page}{comments}{commentauthor} = $commentauthor;
$pagestate{$page}{comments}{commentauthorurl} = $commentauthorurl;
--
cgit v1.2.3
From 8a9f4e225f1c54705fa6d7061724b62fe11ae8fa Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Thu, 18 Dec 2008 19:57:03 +0000
Subject: comments: remove linkuser(), it's been integrated into preprocess()
now
---
IkiWiki/Plugin/comments.pm | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 336ed1a82..bd09c6b25 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -254,27 +254,6 @@ sub linkcgi ($) {
}
}
-# FIXME: basically the same logic as recentchanges
-# returns (author URL, pretty-printed version)
-sub linkuser ($) {
- my $user = shift;
- my $oiduser = eval { IkiWiki::openiduser($user) };
-
- if (defined $oiduser) {
- return ($user, $oiduser);
- }
- # FIXME: it'd be good to avoid having such a link for anonymous
- # posts
- else {
- return (IkiWiki::cgiurl(
- do => 'commenter',
- page => (length $config{userdir}
- ? "$config{userdir}/$user"
- : "$user")
- ), $user);
- }
-}
-
# Mostly cargo-culted from IkiWiki::plugin::editpage
sub sessioncgi ($$) {
my $cgi=shift;
--
cgit v1.2.3
From 8ed94c0a18435f3a1934e19949153c7ccf8ec78a Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Thu, 18 Dec 2008 19:57:25 +0000
Subject: comments: pass COMMENTOPENID to templates
---
IkiWiki/Plugin/comments.pm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index bd09c6b25..d095a00bd 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -573,6 +573,11 @@ sub pagetemplate (@) {
$pagestate{$page}{comments}{commentuser});
}
+ if ($template->query(name => 'commentopenid')) {
+ $template->param(commentopenid =>
+ $pagestate{$page}{comments}{commentopenid});
+ }
+
if ($template->query(name => 'commentip')) {
$template->param(commentip =>
$pagestate{$page}{comments}{commentip});
--
cgit v1.2.3
From 9e889c39ed9971e31dc33f4dea73a91d6938b535 Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Thu, 18 Dec 2008 20:01:08 +0000
Subject: comments: Rename COMMENTURL to ADDCOMMENTURL to avoid confusion with
COMMENTAUTHORURL
Also refactor page.tmpl to use if/else rather than unless/if.
---
IkiWiki/Plugin/comments.pm | 4 ++--
templates/page.tmpl | 9 ++++-----
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index d095a00bd..4f3b76db3 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -548,9 +548,9 @@ sub pagetemplate (@) {
}
if ($shown && commentsopen($page)) {
- my $commenturl = IkiWiki::cgiurl(do => 'comment',
+ my $addcommenturl = IkiWiki::cgiurl(do => 'comment',
page => $page);
- $template->param(commenturl => $commenturl);
+ $template->param(addcommenturl => $addcommenturl);
}
}
diff --git a/templates/page.tmpl b/templates/page.tmpl
index 21abc979d..f75491127 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -74,13 +74,12 @@
--
cgit v1.2.3
From 045cbb2a14aa03a758fc2b5d3bf31e14113446ec Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Thu, 18 Dec 2008 20:28:41 +0000
Subject: comments_display: display (?) for anon users, {x} for OpenIDs and {*}
for local logins
This is a mockup of Joey's idea; to do it properly, the icons should
move to the basewiki or to a comments underlay, and {x} should be
replaced with an OpenID logo (if one with clear licensing even exists).
---
templates/comment.tmpl | 37 +++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)
diff --git a/templates/comment.tmpl b/templates/comment.tmpl
index 19698cd33..3f2978675 100644
--- a/templates/comment.tmpl
+++ b/templates/comment.tmpl
@@ -2,27 +2,44 @@
--
cgit v1.2.3
From f94665800c9353f2b0f190190c0490f51a897973 Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Sat, 20 Dec 2008 17:39:55 +0000
Subject: comment.tmpl: make anon/OpenID/signed-in icons independent of smileys
---
doc/wikiicons/anonymous.png | Bin 0 -> 302 bytes
doc/wikiicons/openid.png | Bin 0 -> 297 bytes
doc/wikiicons/signedin.png | Bin 0 -> 370 bytes
templates/comment.tmpl | 6 +++---
4 files changed, 3 insertions(+), 3 deletions(-)
create mode 100644 doc/wikiicons/anonymous.png
create mode 100644 doc/wikiicons/openid.png
create mode 100644 doc/wikiicons/signedin.png
diff --git a/doc/wikiicons/anonymous.png b/doc/wikiicons/anonymous.png
new file mode 100644
index 000000000..df22152e6
Binary files /dev/null and b/doc/wikiicons/anonymous.png differ
diff --git a/doc/wikiicons/openid.png b/doc/wikiicons/openid.png
new file mode 100644
index 000000000..c5535c3de
Binary files /dev/null and b/doc/wikiicons/openid.png differ
diff --git a/doc/wikiicons/signedin.png b/doc/wikiicons/signedin.png
new file mode 100644
index 000000000..969908d39
Binary files /dev/null and b/doc/wikiicons/signedin.png differ
diff --git a/templates/comment.tmpl b/templates/comment.tmpl
index 3f2978675..2fb54fe7d 100644
--- a/templates/comment.tmpl
+++ b/templates/comment.tmpl
@@ -7,13 +7,13 @@ Posted by
-
-
@@ -31,7 +31,7 @@ Posted by
-
+
--
cgit v1.2.3