r51649 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51648‎ | r51649 | r51650 >
Date:16:37, 9 June 2009
Author:werdna
Status:deferred
Tags:
Comment:
Implement email notification for talk page changes
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/LqtNewMessages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/LqtNewMessages.php
@@ -45,15 +45,6 @@
4646
4747 wfDebugLog( 'LiquidThreads', 'Doing notifications' );
4848
49 - if ( $t->article()->getTitle()->getNamespace() == NS_USER ) {
50 - $name = $t->article()->getTitle()->getDBkey();
51 - list( $name ) = split( '/', $name ); // subpages
52 - $user = User::newFromName( $name );
53 - if ( $user && $user->getID() != $changeUser->getID() ) {
54 - $user->setNewtalk( true );
55 - }
56 - }
57 -
5849 $dbw =& wfGetDB( DB_MASTER );
5950
6051 $talkpage_t = $t->article()->getTitle()->getSubjectPage();
@@ -126,6 +117,28 @@
127118 // Avoids duplicates
128119 $update_tuples = array_values( $update_tuples );
129120
 121+ // Add user talk notification
 122+ if ( $t->article()->getTitle()->getNamespace() == NS_USER_TALK ) {
 123+ $name = $t->article()->getTitle()->getText();
 124+
 125+ $user = User::newFromName( $name );
 126+ if ( $user ) {
 127+ $user->setNewtalk( true );
 128+
 129+ $dbw->replace( 'user_message_state',
 130+ array( array( 'ums_user', 'ums_thread' ) ),
 131+ array( 'ums_user' => $user->getId(),
 132+ 'ums_thread' => $t->id(),
 133+ 'ums_read_timestamp' => null ),
 134+ __METHOD__ );
 135+
 136+ if ( $user->getOption( 'enotifusertalkpages' ) ) {
 137+ $notify_users[] = $user->getId();
 138+ }
 139+ }
 140+
 141+ }
 142+
130143 // Do the actual updates
131144 if ( count($insert_rows) ) {
132145 $dbw->insert( 'user_message_state', $insert_rows, __METHOD__, array( 'IGNORE' ) );

Status & tagging log