r87271 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87270‎ | r87271 | r87272 >
Date:18:30, 2 May 2011
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
AFT Fixes
* Linking page titles in the Dashboard at Special:ArticleFeedback
* (bug 28125) Don't load the ext.articleFeedback module, nor initialize it on inexisting pages
*
Modified paths:
  • /trunk/extensions/ArticleFeedback/SpecialArticleFeedback.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.startup.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/SpecialArticleFeedback.php
@@ -96,7 +96,8 @@
9797 $rows = array();
9898 foreach ( $this->getDailyHighsAndLows() as $page ) {
9999 $row = array();
100 - $row['page'] = $page['page'];
 100+ $pageTitle = Title::newFromText( $page['page'] );
 101+ $row['page'] = Linker::link( $pageTitle, $pageTitle->getPrefixedText() );
101102 foreach ( $page['ratings'] as $id => $value ) {
102103 $row['rating-' . $id] = $value;
103104 }
@@ -126,7 +127,8 @@
127128 $rows = array();
128129 foreach ( $this->getWeeklyMostChanged() as $page ) {
129130 $row = array();
130 - $row['page'] = $page['page'];
 131+ $pageTitle = Title::newFromText( $page['page'] );
 132+ $row['page'] = Linker::link( $pageTitle, $pageTitle->getPrefixedText() );
131133 foreach ( $page['changes'] as $id => $value ) {
132134 $row['rating-' . $id] = $value;
133135 }
@@ -154,7 +156,8 @@
155157 $rows = array();
156158 foreach ( $this->getRecentLows() as $page ) {
157159 $row = array();
158 - $row['page'] = $page['page'];
 160+ $pageTitle = Title::newFromText( $page['page'] );
 161+ $row['page'] = Linker::link( $pageTitle, $pageTitle->getPrefixedText() );
159162 foreach ( $wgArticleFeedbackRatings as $category ) {
160163 $row[] = array(
161164 'attr' => in_array( $category, $page['categories'] )
@@ -196,13 +199,23 @@
197200 array(
198201 'page' => 'Main Page',
199202 // List of ratings as the currently stand
200 - 'ratings' => array( 1 => 4, 2 => 3, 3 => 2, 4 => 1 ),
 203+ 'ratings' => array(
 204+ 1 => 4,
 205+ 2 => 3,
 206+ 3 => 2,
 207+ 4 => 1,
 208+ ),
201209 // Current average (considering historic averages of each rating)
202210 'average' => 2.5
203211 ),
204212 array(
205213 'page' => 'Test Article',
206 - 'ratings' => array( 1 => 1, 2 => 2, 3 => 3, 4 => 4 ),
 214+ 'ratings' => array(
 215+ 1 => 1,
 216+ 2 => 2,
 217+ 3 => 3,
 218+ 4 => 4,
 219+ ),
207220 'average' => 2.5
208221 )
209222 );
@@ -222,11 +235,21 @@
223236 array(
224237 'page' => 'Main Page',
225238 // List of differences for each rating in the past 7 days
226 - 'changes' => array( 1 => 1, 2 => -2, 3 => 0, 4 => 0 ),
 239+ 'changes' => array(
 240+ 1 => 1,
 241+ 2 => 2,
 242+ 3 => 0,
 243+ 4 => 0,
 244+ ),
227245 ),
228246 array(
229247 'page' => 'Test Article',
230 - 'changes' => array( 1 => 0, 2 => 0, 3 => 1, 4 => 2 ),
 248+ 'changes' => array(
 249+ 1 => 0,
 250+ 2 => 0,
 251+ 3 => 1,
 252+ 4 => 2,
 253+ ),
231254 )
232255 );
233256 }
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.startup.js
@@ -6,11 +6,12 @@
77 if (
88 // Main namespace articles
99 mw.config.get( 'wgNamespaceNumber' ) === 0
 10+ // Existing pages
 11+ && mw.config.get( 'wgArticleId', 0 ) > 0
1012 // View pages
11 - && mw.config.get( 'wgAction' ) === 'view'
 13+ && ( mw.config.get( 'wgAction' ) == 'view' || mw.config.get( 'wgAction' ) == 'view' )
1214 // Current revision
13 - && mw.util.getParamValue( 'diff' ) === null
14 - && mw.util.getParamValue( 'oldid' ) === null
 15+ && ( mw.util.getParamValue( 'diff' ) == null && mw.util.getParamValue( 'oldid' ) == null )
1516 ) {
1617 var trackingBucket = mw.user.bucket(
1718 'ext.articleFeedback-tracking', mw.config.get( 'wgArticleFeedbackTracking' )

Follow-up revisions

RevisionCommit summaryAuthorDate
r87274Follow-up r87271: Also load on purge (= view); getArticleId is 0 by default, ...krinkle18:34, 2 May 2011
r87454Using $wgUser->getSkin() to call link() instead of Linker:: - fixes backwards...tparscal21:20, 4 May 2011

Comments

#Comment by DieBuche (talk | contribs)   13:11, 6 July 2011

L224: After reformatting -2 became a 2. On purpose? Otherwise it looks fine.

#Comment by Krinkle (talk | contribs)   17:57, 6 July 2011

They were dummy values since the database didn't exist yet at this point in development. I choose different dummy values per experimentation.

That part of the commit is redundant tho as those functions no longer exist.

Status & tagging log