• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7409: Don't notify oneself; use CGI referer for OK link

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension WatchlistPlugin Enhancement Closed   patch 6.0.1

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

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

ItemTemplate
Summary Don't notify oneself; use CGI referer for OK link
ReportedBy TWiki:Main.TimotheLitt
Codebase ~twiki4, 6.0.0, 4.2.3
SVN Range TWiki-6.0.1-trunk, Thu, 09 Jan 2014, build 26720
AppliesTo Extension
Component WatchlistPlugin
Priority Enhancement
CurrentState Closed
WaitingFor

Checkins TWikirev:26920 TWikirev:26921 TWikirev:26922 TWikirev:26923 TWikirev:26924 TWikirev:26925 TWikirev:26926 TWikirev:26927
TargetRelease patch
ReleasedIn 6.0.1
Edit | Attach | Watch | Print version | History: r13 < r12 < r11 < r10 < r9 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r13 - 2014-10-06 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback