I consider the WatchlistPlugin's behavior of sending an e-mail to the person making a change to be bug.
My users (I backported the necessary infrastructure) consider it a
serious bug. They used the word "SPAM".
Here is a patch that corrects this misbehavior for immediate mode (on topic save).
--- /var/www/servers/twiki/lib/TWiki/Plugins/WatchlistPlugin/Core.pm~ 2014-01-15 15:07:33.000000000 -0500
+++ /var/www/servers/twiki/lib/TWiki/Plugins/WatchlistPlugin/Core.pm 2014-01-15 16:36:13.000000000 -0500
@@ -139,14 +139,16 @@
### my ( $text, $topic, $web, $error, $meta ) = @_;
my $this = shift;
my $web = $_[2];
my $topic = $_[1];
+ my $savingUser = TWiki::Func::getWikiName || '';
my @topics = $this->_findWatchlistTopicsByWatchedTopic( "$web.$topic" );
foreach my $wikiUser ( $this->_findWatchlistTopicsByPrefs( \@topics, 'n1' ) ) {
$wikiUser =~ s/Watchlist$//;
- $this->_sendWatchlistEmail( $web, $topic, $wikiUser );
+ $this->_sendWatchlistEmail( $web, $topic, $wikiUser )
+ unless( $wikiUser eq $savingUser );
}
}
# =========================
sub afterRenameHandler {
The digest mode sender (watchlistNotify) should also suppress sending mail if the last change to a watched topic was by the watching user.
We can conditionalize on the last change since any other changes in the period should have been seen when the last edit was made.
That simplifies the bookkeeping, so it's also a simple patch (move 2 lines and add one test):
@@ -181,10 +183,12 @@
my $viewScriptUrl = TWiki::Func::getViewUrl( 'WebName', 'TopicName' );
$viewScriptUrl =~ s/.WebName.TopicName//o; # cut weband topic
foreach my $topic ( $this->_findWatchlistTopicsByPrefs( undef, 'n2' ) ) {
print "- processing $web.$topic\n" .
" - updated since last time: " if( $verbose );
+ my $wikiUser = $topic;
+ $wikiUser =~ s/Watchlist$//;
my $webItrs;
my $webData;
my $dateRef;
my $wTopics = $this->_getWatchedTopics( $web, $topic );
foreach my $item ( split( /,\s*/, $wTopics ) ) {
@@ -202,11 +206,11 @@
time => $change->{time},
rev => $change->{revision},
};
}
}
- if( $webData->{$w}{$t} ) {
+ if( $webData->{$w}{$t} && $webData->{$w}{$t}{user} ne $wikiUser ) {
# changed topic is watched, so add to date reference
$dateRef->{"$w~$t"} = $webData->{$w}{$t}{time};
print "$w.$t, " if( $verbose );
}
}
@@ -235,12 +239,10 @@
print "$line" if( $verbose );
}
$text =~ s/[\r\n]*$//s;
# Notify user
- my $wikiUser = $topic;
- $wikiUser =~ s/Watchlist$//;
my $topicList = join( ', ', sort @webTopics );
$this->_sendWatchlistEmail( $w, $t, $wikiUser, $text, $topicList );
} else {
print "(none)\n" if( $verbose );
}
--
TWiki:Main/TimotheLitt
- 2014-01-15
Thanks Timothe for the patch, this is now incorporated.
Related
TWiki:Support/SID-01858
, I also applied the patch, but only for the note message, not the error message. It makes sense to dismiss the error message.
--
TWiki:Main.PeterThoeny
- 2014-01-16