From: Joey Hess Date: Fri, 13 Apr 2012 18:28:02 +0000 (-0400) Subject: add comment subscription checkbox to editpage X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/e81e857ba62970caefd0f674d2cdfc3f9b70fe09 add comment subscription checkbox to editpage Reworded template, which also called the commit message a "comment". --- diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index d3c695935..d15607990 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -64,7 +64,8 @@ sub cgi_editpage ($$) { decode_cgi_utf8($q); - my @fields=qw(do rcsinfo subpage from page type editcontent editmessage); + my @fields=qw(do rcsinfo subpage from page type editcontent + editmessage subscribe); my @buttons=("Save Page", "Preview", "Cancel"); eval q{use CGI::FormBuilder}; error($@) if $@; @@ -157,6 +158,17 @@ sub cgi_editpage ($$) { noimageinline => 1, linktext => "FormattingHelp")); + my $cansubscribe=IkiWiki::Plugin::notifyemail->can("subscribe") + && IkiWiki::Plugin::comments->can("import") + && defined $session->param('name'); + if ($cansubscribe) { + $form->field(name => "subscribe", type => "checkbox", + options => [gettext("email comments to me")]); + } + else { + $form->field(name => "subscribe", type => 'hidden'); + } + my $previewing=0; if ($form->submitted eq "Cancel") { if ($form->field("do") eq "create" && defined $from) { @@ -448,6 +460,12 @@ sub cgi_editpage ($$) { # caches and get the most recent version of the page. redirect($q, $baseurl."?updated"); } + + if ($cansubscribe && length $form->field("subscribe")) { + my $subspec="comment($page)"; + IkiWiki::Plugin::notifyemail::subscribe( + $session->param('name'), $subspec); + } } exit; diff --git a/debian/changelog b/debian/changelog index 5f9472365..b994fb55e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ ikiwiki (3.20120204) UNRELEASED; urgency=low * meta: Export author information in html tag. Closes: #664779 Thanks, Martin Michlmayr * notifyemail: New plugin, sends email notifications about new and - changed pages. + changed pages, and allows subscribing to comments. * Added a "changes" hook. Renamed the "change" hook to "rendered", but the old hook name is called for now for back-compat. * meta: Support keywords header. Closes: #664780 diff --git a/doc/plugins/notifyemail.mdwn b/doc/plugins/notifyemail.mdwn index 299cab8b1..302979e6e 100644 --- a/doc/plugins/notifyemail.mdwn +++ b/doc/plugins/notifyemail.mdwn @@ -10,5 +10,5 @@ matching the PageSpec will send an email that includes the new content of the page, and a link to the page on the web. To make it easy to subscribe to comment threads when posting a comment, -there is a check box that can be used to subscribe, without needing to -manually edit the [[ikiwiki/PageSpec]]. +or a page, there is a check box that can be used to subscribe, without +needing to manually edit the [[ikiwiki/PageSpec]]. diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl index 696c8dcad..4736c95d0 100644 --- a/templates/editpage.tmpl +++ b/templates/editpage.tmpl @@ -18,13 +18,16 @@
- +
Attachments + + +