When toggling the watch status of a topic, WatchlistPlugin doesn't set the 'minor' flag if it must create the *Watchlist topic. This causes *Watchlist creation to appear in the MailerContrib topic change e-mails, unless a user explicitly excludes them.
Creation of *Watchlists is not interesting, as they record a change to a per-user preference and it's that user who makes the change. Why would the other 10,000 users care that I just created my Watchlist? Why would I want 10,000 notices that each of them created theirs?
Since MailerContrib was there first, and the default is to watch '*', this amounts to having MailerContrib spam on behalf of WatchlistPlugin. This is undesirable.
Note that the calls to
saveTopicText
do set the 'minor revision' flag; only the call to
saveTopic
fails to do so.
Fix:
--- /var/www/servers/twiki/lib/TWiki/Plugins/WatchlistPlugin/Core.pm~ 2014-01-16 10:30:12.000000000 -0500
+++ /var/www/servers/twiki/lib/TWiki/Plugins/WatchlistPlugin/Core.pm 2014-01-17 06:56:03.000000000 -0500
@@ -300,11 +300,11 @@
# watchlist topic does not exist, so create it
my ( $meta, $text ) = TWiki::Func::readTopic( $TWiki::cfg{SystemWebName},
'WatchlistTemplate' );
$text = TWiki::Func::expandVariablesOnTopicCreation( $text );
$meta->put( 'TOPICPARENT', { name => TWiki::Func::getWikiName() } );
- TWiki::Func::saveTopic( $wWeb, $wTopic, $meta, $text, {} );
+ TWiki::Func::saveTopic( $wWeb, $wTopic, $meta, $text, { minor => 1 } );
}
$this->_updateWatchlistTopic( $wWeb, $wTopic, "$web.$topic", '', 1 );
$this->{redirect} = "$web, $topic";
}
While we're here, the following non-functional changes allow emacs syntax highlighting to parse the file properly (it doesn't find the end of the s/regexs). It's also safer syntax for a code (/e) replacement.
--- /var/www/servers/twiki/lib/TWiki/Plugins/WatchlistPlugin/Core.pm.orig 2013-09-15 18:09:19.000000000 -0400
+++ /var/www/servers/twiki/lib/TWiki/Plugins/WatchlistPlugin/Core.pm 2014-01-17 06:56:03.000000000 -0500
@@ -281,11 +283,11 @@
$url = '%SCRIPTURL{viewauth}%/' . "$web/$topic?createifnotexist=1"
. ';templatetopic=%SYSTEMWEB%.WatchlistTemplate;topicparent=' . $wikiName
}
$format =~ s/\$url/$url/go;
$format =~ s/\$wikiname/$wikiName/go;
- $format =~ s/\$watch/ $this->{baseWatchFlag} ? 'Unwatch' : 'Watch' /geo;
+ $format =~ s{\$watch}{ $this->{baseWatchFlag} ? 'Unwatch' : 'Watch' }geo;
$this->{text} .= $format;
}
# =========================
sub _actionToggleWatch {
@@ -298,11 +300,11 @@
# watchlist topic does not exist, so create it
my ( $meta, $text ) = TWiki::Func::readTopic( $TWiki::cfg{SystemWebName},
'WatchlistTemplate' );
$text = TWiki::Func::expandVariablesOnTopicCreation( $text );
$meta->put( 'TOPICPARENT', { name => TWiki::Func::getWikiName() } );
- TWiki::Func::saveTopic( $wWeb, $wTopic, $meta, $text, {} );
+ TWiki::Func::saveTopic( $wWeb, $wTopic, $meta, $text, { minor => 1 } );
}
$this->_updateWatchlistTopic( $wWeb, $wTopic, "$web.$topic", '', 1 );
$this->{redirect} = "$web, $topic";
}
--
TWiki:Main/TimotheLitt
- 2014-01-17
Thanks Timothe!
Timothe did the checkin using
Item7411. Marking as "waiting for release".
--
TWiki:Main.PeterThoeny
- 2014-05-19