r74967 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74966‎ | r74967 | r74968 >
Date:20:50, 18 October 2010
Author:hashar
Status:reverted (Comments)
Tags:
Comment:
* Let user receives its own comments by emails if already wants
to receive its own emails ('ccmeonemails' user option).
* Fix svnImport errors when author can not be matched with a wiki user.
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -309,7 +309,8 @@
310310 if ( $wgEnableEmail && $newRevision && count( $affectedRevs ) > 0 ) {
311311 // Get committer wiki user name, or repo name at least
312312 $commitAuthor = $this->getWikiUser();
313 - $commitAuthorId = $commitAuthor->getId();
 313+ # Author might not have a username in the wiki:
 314+ $commitAuthorId = $commitAuthor ? $commitAuthor->getId() : false;
314315 $committer = $commitAuthor ? $commitAuthor->getName() : htmlspecialchars( $this->mAuthor );
315316 // Get the authors of these revisions
316317 $res = $dbw->select( 'code_rev',
@@ -345,15 +346,18 @@
346347 $revisionAuthor = $revision->getWikiUser();
347348
348349 //Add the followup revision author if they have not already been added as a commentor (they won't want dupe emails!)
349 - if ( !array_key_exists( $revisionAuthor->getId(), $users ) ) {
 350+ if ( $revisionAuthor && !array_key_exists( $revisionAuthor->getId(), $users ) ) {
350351 $users[$revisionAuthor->getId()] = $revisionAuthor;
351352 }
352353
353354 //Notify commenters and revision author of followup revision
354355 foreach ( $users as $userId => $user ) {
355 - // No sense in notifying the author of this rev if they are a commenter/the author on the target rev
 356+ // Notify user with its own message if he already want
 357+ // to be CCed of all emails it sends.
356358 if ( $commitAuthorId == $user->getId() ) {
357 - continue;
 359+ if(! $user->getBoolOption( 'ccmeonemails' ) ) {
 360+ continue;
 361+ }
358362 }
359363
360364 if ( $user->canReceiveEmail() ) {
@@ -427,9 +431,12 @@
428432 $url = $this->getFullUrl( $commentId );
429433
430434 foreach ( $users as $userId => $user ) {
431 - // No sense in notifying this commenter
 435+ // Notify user with its own message if he already want
 436+ // to be CCed of all emails it sends.
432437 if ( $wgUser->getId() == $user->getId() ) {
433 - continue;
 438+ if(! $user->getBoolOption( 'ccmeonemails' ) ) {
 439+ continue;
 440+ }
434441 }
435442
436443 if ( $user->canReceiveEmail() ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r77111unconditionally send email to comment author...hashar19:16, 22 November 2010
r78443MFT part of r74967: fix for no user existing for an author, was causing pywik...demon17:51, 15 December 2010
r83182Revert r77111 due to many people not liking the behaviour....reedy23:54, 3 March 2011
r83184Revert r74967 alsoreedy23:59, 3 March 2011

Comments

#Comment by Platonides (talk | contribs)   21:06, 18 October 2010

I don't think it's comparable. Special:Emailuser has a nice checkbox.

This should be optional or a different preference.

#Comment by 😂 (talk | contribs)   16:32, 6 November 2010

Reusing preferences is bad. Introducing new ones also bad. I think we should just decide on default sane behavior here :)

#Comment by Hashar (talk | contribs)   13:18, 7 November 2010

I would go to force reception of own comments, just like a mailing list.

#Comment by Hashar (talk | contribs)   16:38, 6 November 2010

The idea behind that was to implements the in-reply-to header. This header let your mail agent thread the messages by conversation. To follow the conversations, it helps to receive our own emails.

I eventually stopped because we have currently no reliable way to get the message-id (it is made from microtime and the apache server hostname that handle the request).

#Comment by Platonides (talk | contribs)   18:06, 6 November 2010

Interesting idea. Can't we manually set the message-id in mediawiki?

#Comment by Hashar (talk | contribs)   18:14, 6 November 2010

It is hardcoded in includes/UserMailer.php in send() (look for: Message-ID )

$headers['Message-ID'] = "<$msgid@" . $wgSMTP['IDHost'] . '>';

We could refactor the send() function to use an array of optional parameters (and get ride of $replyto and $contentType function arguments).

Message identification should be global and is defined in RFC 2822 section 3.6.4 ( http://tools.ietf.org/html/rfc2822#section-3.6.4 ). We could probably forge it using the repository id and comment id, we just MUST make sure we can regenerate it when a user reply to any comment so we can add the In-Reply-To header. Sending host might be added to another header too. Someting like X-Mediawiki-Sending-Host .

#Comment by Hashar (talk | contribs)   19:17, 22 November 2010

unconditionally send with r77111. Marking 'new' again.

Status & tagging log