r54590 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54589‎ | r54590 | r54591 >
Date:16:39, 7 August 2009
Author:jan
Status:reverted (Comments)
Tags:
Comment:
Add after the link for "My Talk" "<number of new messages(edits)>" if there are some
Modified paths:
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SkinTemplate.php
@@ -510,7 +510,7 @@
511511 * @private
512512 */
513513 function buildPersonalUrls() {
514 - global $wgOut, $wgRequest;
 514+ global $wgOut, $wgRequest, $wgUser, $wgLang;
515515
516516 $title = $wgOut->getTitle();
517517 $pageurl = $title->getLocalURL();
@@ -531,8 +531,32 @@
532532 'active' => ( $this->userpageUrlDetails['href'] == $pageurl )
533533 );
534534 $usertalkUrlDetails = $this->makeTalkUrlDetails( $this->userpage );
 535+ if ( $wgUser->getNewtalk() ) {
 536+ # do not show "(!)" text when we are viewing our
 537+ # own talk page
 538+ if( !$title->equals( $wgUser->getTalkPage() ) ) {
 539+ $field = ( $wgUser->getID() == 0 )? 'user_ip' : 'user_id';
 540+ $id = ( $wgUser->getID() == 0 )? $wgUser->getName() : $wgUser->getID();
 541+
 542+ $db = wfGetDB( DB_SLAVE );
 543+ $query = $db->select( 'user_newtalk', $field, array( $field => $id ) );
 544+ $num = $db->numRows( $query );
 545+
 546+ $text = '('.$wgLang->formatNum( $num ).')';
 547+
 548+ # disable caching
 549+ $wgOut->setSquidMaxage( 0 );
 550+ $wgOut->enableClientCache( false );
 551+ }
 552+ else {
 553+ $text = '';
 554+ }
 555+ }
 556+ else {
 557+ $text = '';
 558+ }
535559 $personal_urls['mytalk'] = array(
536 - 'text' => wfMsg( 'mytalk' ),
 560+ 'text' => wfMsg( 'mytalk' ).$text,
537561 'href' => &$usertalkUrlDetails['href'],
538562 'class' => $usertalkUrlDetails['exists'] ? false : 'new',
539563 'active' => ( $usertalkUrlDetails['href'] == $pageurl )

Follow-up revisions

RevisionCommit summaryAuthorDate
r54591Update RELEASE-NOTES for r54590jan16:45, 7 August 2009
r54628(fixes for r54590 & bug 20103) Use now only one query and add number to messa...jan10:37, 8 August 2009
r54733Pull back r54590, r54591, r54628, r54633, r54636, r54714 "Add after the link ...brion19:03, 10 August 2009
r54740Localisation updates for core messages from translatewiki.net...siebrand20:45, 10 August 2009

Comments

#Comment by 😂 (talk | contribs)   17:21, 7 August 2009

Needs fixing. Should not hardcode (#) after the message, add $1 to the message and put the count as parameter. Also, the implementation (extra query just to show a number) is less than ideal.

Status & tagging log