r72930 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72929‎ | r72930 | r72931 >
Date:20:22, 13 September 2010
Author:adam
Status:resolved (Comments)
Tags:
Comment:
ArticleAssessment js improvements - making the cookie hang around for 30 days, getting rid of the unrequired revid param, and fixing the stale message displaying
Modified paths:
  • /trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js
@@ -78,7 +78,7 @@
7979 return randomstring;
8080 }
8181 userToken = randomString( 32 );
82 - $.cookie( 'mwArticleAssessmentUserToken', userToken );
 82+ $.cookie( 'mwArticleAssessmentUserToken', userToken, { 'expires': 30, 'path': '/' } );
8383 }
8484 if ( !wgUserName ) {
8585 config.userID = userToken;
@@ -220,13 +220,13 @@
221221 $( '#article-assessment input[type=submit]' )
222222 .attr( 'disabled', 'disabled' );
223223 },
 224+
224225 // Request the ratings data for the current article
225226 'getRatingData': function() {
226227 var config = $( '#article-assessment' ).data( 'articleAssessment-context' ).config;
227228 var requestData = {
228229 'action': 'query',
229230 'list': 'articleassessment',
230 - 'aarevid': config.revID,
231231 'aapageid': config.pageID,
232232 'aauserrating': 1,
233233 'format': 'json'
@@ -267,7 +267,7 @@
268268 }
269269 }
270270 // if the rating is stale, add the stale class
271 - if( data.query.articleassessment.stale ) {
 271+ if( data.query.articleassessment[0].revid < wgCurRevisionId ) {
272272 // add the stale star class to each on star
273273 $( '.ui-stars-star-on' )
274274 .addClass( 'ui-stars-star-stale' );

Comments

#Comment by Catrope (talk | contribs)   12:47, 14 September 2010
-					if( data.query.articleassessment.stale ) {
+					if( data.query.articleassessment[0].revid <  wgCurRevisionId ) {

These don't mean the same thing. The former is only true if the last rating was at least $wgArticleAssessmentStaleCount (=5 by default) revisions ago, whereas the latter is true if the last rating was at least one revision ago.

#Comment by Adammiller~mediawikiwiki (talk | contribs)   13:01, 14 September 2010

I know they're not the same thing. You told me to change the messaging to use "this article has been revised since you rated it", which implies, to me at least, that we should tell the user as soon as the article has been revised, not wait until it's been revised five times. I can switch it if no one else sees that as a problem.

#Comment by Catrope (talk | contribs)   13:50, 14 September 2010

The message was changed so we wouldn't have to calculate the exact number of revisions. Brandon chose to go with "has been revised" rather than "has been revised more than n times", but AFAIK the behavior should still be the same.

We should talk to Brandon about this.

#Comment by Catrope (talk | contribs)   12:47, 22 September 2010

Fixed in r73063, r73069 and r73138

Status & tagging log