r25969 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25968‎ | r25969 | r25970 >
Date:19:05, 20 September 2007
Author:david
Status:old
Tags:
Comment:
Watches appear to be working.
Modified paths:
  • /branches/liquidthreads/extensions/LqtModel.php (modified) (history)
  • /branches/liquidthreads/extensions/LqtPages.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtPages.php
@@ -1027,19 +1027,19 @@
10281028
10291029 $hook_sql = "AND page_namespace != " . NS_LQT_THREAD;
10301030
1031 - $user_messages = NewMessages::newUserMessages($user);
1032 - $n = count($user_messages);
 1031+ $talkpage_messages = NewMessages::newUserMessages($user);
 1032+ $tn = count($talkpage_messages);
10331033
1034 - if( $n == 0 )
 1034+ $watch_messages = NewMessages::watchedThreadsForUser($user);
 1035+ $wn = count($watch_messages);
 1036+
 1037+ if( $tn == 0 && $wn == 0 )
10351038 return true;
10361039
1037 - if ( $n == 1 ) $phrase = "is 1 message";
1038 - else $phrase = "are $n messages";
1039 -
10401040 $messages_url = SpecialPage::getPage('Newmessages')->getTitle()->getFullURL();
10411041 $wgOut->addHTML(<<< HTML
10421042 <a href="$messages_url" class="lqt_watchlist_messages_notice">
1043 - &#x2712; There $phrase for you.
 1043+ &#x2712; There are new messages for you.
10441044 </a>
10451045 HTML
10461046 );
Index: branches/liquidthreads/extensions/LqtModel.php
@@ -1035,8 +1035,10 @@
10361036
10371037 // it sucks to not have 'on duplicate key update'. first update users who already have a ums for this thread
10381038 // and who have already read it, by setting their state to unread.
1039 - $dbw->query("update user_message_state, thread, watchlist set ums_read_timestamp = null where ums_user = wl_user and ums_thread = thread_id and $where_clause");
10401039
 1040+ // this is touching all ums rows instead of just the ones for the thread in question.
 1041+ $dbw->query("update user_message_state, watchlist set ums_read_timestamp = null where ums_user = wl_user and ums_thread = {$t->id()} and $where_clause");
 1042+
10411043 $dbw->query("insert ignore into user_message_state (ums_user, ums_thread) select user_id, {$t->id()} from user, watchlist where user_id = wl_user and $where_clause;");
10421044 }
10431045
@@ -1048,6 +1050,7 @@
10491051
10501052 static function watchedThreadsForUser($user) {
10511053 return Threads::where( array('ums_read_timestamp is null',
 1054+ 'ums_user' => $user->getID(),
10521055 'ums_thread = thread.thread_id',
10531056 'NOT (' . Threads::articleClause(new Article($user->getUserPage())) . ')' ),
10541057 array(), array('user_message_state') );

Status & tagging log