Index: trunk/extensions/LiquidThreads/Lqt.i18n.php |
— | — | @@ -128,6 +128,7 @@ |
129 | 129 | 'lqt-email-undo' => 'Undo', |
130 | 130 | 'lqt-messages-sent' => 'Messages sent to you:', |
131 | 131 | 'lqt-other-messages' => 'Messages on other talk pages:', |
| 132 | + 'lqt-no-new-messages' => 'There are no new messages for you.', |
132 | 133 | 'lqt-new-messages' => 'There are new messages for you.', |
133 | 134 | 'lqt-email-info-undo' => 'Bring back the thread you just dismissed.', |
134 | 135 | 'lqt-date-info' => 'This link is disabled because you are viewing threads from all dates.', |
Index: trunk/extensions/LiquidThreads/LqtPages.php |
— | — | @@ -1154,6 +1154,8 @@ |
1155 | 1155 | function showUndo($ids) { |
1156 | 1156 | if( count($ids) == 1 ) { |
1157 | 1157 | $t = Threads::withId($ids[0]); |
| 1158 | + if( !$t ) |
| 1159 | + return; // empty or just bogus operand. |
1158 | 1160 | $msg = wfMsg( 'lqt-marked-read',$t->subject() ); |
1159 | 1161 | } else { |
1160 | 1162 | $count = count($ids); |
— | — | @@ -1195,17 +1197,19 @@ |
1196 | 1198 | $ids = explode(',', $this->request->getVal('lqt_operand', '')); |
1197 | 1199 | if( $ids !== false ) { |
1198 | 1200 | foreach($ids as $id) { |
1199 | | - NewMessages::markThreadAsUnreadByUser(Threads::withId($id), $this->user); |
| 1201 | + $tmp_thread = Threads::withId($id); if($tmp_thread) |
| 1202 | + NewMessages::markThreadAsReadByUser($tmp_thread, $this->user); |
1200 | 1203 | } |
1201 | 1204 | $this->output->redirect( $this->title->getFullURL() ); |
1202 | 1205 | } |
1203 | 1206 | } |
1204 | 1207 | |
1205 | 1208 | else if( $this->request->wasPosted() && $this->methodApplies('mark_as_read') ) { |
1206 | | - $ids = explode(',', $this->request->getVal('lqt_operand', '')); |
| 1209 | + $ids = explode(',', $this->request->getVal('lqt_operand')); |
1207 | 1210 | if( $ids !== false ) { |
1208 | 1211 | foreach($ids as $id) { |
1209 | | - NewMessages::markThreadAsReadByUser(Threads::withId($id), $this->user); |
| 1212 | + $tmp_thread = Threads::withId($id); if($tmp_thread) |
| 1213 | + NewMessages::markThreadAsReadByUser($tmp_thread, $this->user); |
1210 | 1214 | } |
1211 | 1215 | $query = 'lqt_method=undo_mark_as_read&lqt_operand=' . implode(',', $ids); |
1212 | 1216 | $this->output->redirect( $this->title->getFullURL($query) ); |
— | — | @@ -1280,15 +1284,20 @@ |
1281 | 1285 | $this->setHeaders(); |
1282 | 1286 | |
1283 | 1287 | $view = new NewUserMessagesView( $this->output, new Article($this->title), |
1284 | | - $this->title, $this->user, $this->request ); |
| 1288 | + $this->title, $this->user, $this->request ); |
1285 | 1289 | |
| 1290 | + $view->showOnce(); // handles POST etc. |
| 1291 | + |
1286 | 1292 | $first_set = NewMessages::newUserMessages($this->user); |
1287 | 1293 | $second_set = NewMessages::watchedThreadsForUser($this->user); |
1288 | 1294 | $both_sets = array_merge($first_set, $second_set); |
| 1295 | + if( count($both_sets) == 0 ) { |
| 1296 | + $wgOut->addWikitext( wfMsg('lqt-no-new-messages') ); |
| 1297 | + return; |
| 1298 | + } |
1289 | 1299 | $view->showReadAllButton($both_sets); // ugly hack. |
1290 | 1300 | |
1291 | 1301 | $view->setHeaderLevel(3); |
1292 | | - $view->showOnce(); // handles POST etc. |
1293 | 1302 | |
1294 | 1303 | $this->output->addHTML('<h2 class="lqt_newmessages_section">'.wfMsg ( 'lqt-messages-sent' ).'</h2>'); |
1295 | 1304 | $view->setThreads( $first_set ); |