jenkins-bot has submitted this change and it was merged. Change subject: (bug 24292) Update new messages count after marking all threads as read ......................................................................
(bug 24292) Update new messages count after marking all threads as read Change-Id: I64682c54a261a965eb30812bb4c19c1b9843686b --- M api/ApiThreadAction.php M newmessages.js 2 files changed, 14 insertions(+), 0 deletions(-) Approvals: Siebrand: Looks good to me, approved jenkins-bot: Verified diff --git a/api/ApiThreadAction.php b/api/ApiThreadAction.php index 8dbd068..4df5a5c 100644 --- a/api/ApiThreadAction.php +++ b/api/ApiThreadAction.php @@ -54,10 +54,16 @@ if ( in_array( 'all', $threads ) ) { NewMessages::markAllReadByUser( $user ); + $newMessagesCount = NewMessages::newMessageCount( $user ); $result[] = array( 'result' => 'Success', 'action' => 'markread', 'threads' => 'all', + 'unreadlink' => array( + 'href' => SpecialPage::getTitleFor( 'NewMessages' )->getLocalURL(), + 'text' => wfMessage( $newMessagesCount ? 'lqt-newmessages-n' : 'lqt_newmessages' )->numParams( $newMessagesCount )->text(), + 'active' => $newMessagesCount > 0, + ) ); } else { foreach ( $threads as $t ) { @@ -69,6 +75,12 @@ 'title' => $t->title()->getPrefixedText() ); } + $newMessagesCount = NewMessages::newMessageCount( $user ); + $result[count( $result ) - 1]['unreadlink'] = array( // Only bother to put this on the last threadaction + 'href' => SpecialPage::getTitleFor( 'NewMessages' )->getLocalURL(), + 'text' => wfMessage( $newMessagesCount ? 'lqt-newmessages-n' : 'lqt_newmessages' )->numParams( $newMessagesCount )->text(), + 'active' => $newMessagesCount > 0, + ); } $this->getResult()->setIndexedTagName( $result, 'thread' ); diff --git a/newmessages.js b/newmessages.js index 67e6241..f0c526b 100644 --- a/newmessages.js +++ b/newmessages.js @@ -98,6 +98,7 @@ liquidThreads.apiRequest( markReadParameters, function(e) { liquidThreads.markReadDone.one(e,form.find('input[type=submit]'),operand); + $( 'li#pt-newmessages' ).html( $( '<a>', e.threadactions[e.threadactions.length - 1].unreadlink ) ); // Unreadlink will be on the last threadaction spinner.remove(); } ); }, @@ -115,6 +116,7 @@ liquidThreads.apiRequest( request, function(res) { liquidThreads.markReadDone.all(res); + $( 'li#pt-newmessages' ).html( $( '<a>', res.threadactions[0].unreadlink ) ); spinner.remove(); } ); } -- To view, visit https://gerrit.wikimedia.org/r/32914 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I64682c54a261a965eb30812bb4c19c1b9843686b Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/LiquidThreads Gerrit-Branch: master Gerrit-Owner: Huji <huji.h...@gmail.com> Gerrit-Reviewer: Alex Monk <kren...@gmail.com> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits