r113370 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113369‎ | r113370 | r113371 >
Date:16:43, 8 March 2012
Author:emsmith
Status:resolved (Comments)
Tags:todo 
Comment:
bug 34090 - make different titles for masking appear if it's been hidden or oversighted. Add links to the user pages for the red lines on the overlays, fix a bug where the item wasn't being added in the right spot, moved the "make a user link" to the utils class since it was being used in several places
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewActivityArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -142,9 +142,10 @@
143143 'articlefeedbackv5-timestamp-months' => '{{PLURAL:$1|$1 month|$1 months}}',
144144 'articlefeedbackv5-timestamp-weeks' => '{{PLURAL:$1|$1 week|$1 weeks}}',
145145 'articlefeedbackv5-timestamp-seconds' => 'less than 1 minute',
146 - 'articlefeedbackv5-mask-text' => 'Feedback hidden by administrative action. Click to view contents.',
 146+ 'articlefeedbackv5-mask-text-hidden' => 'This post was hidden by an authorized editor',
 147+ 'articlefeedbackv5-mask-text-overarticlefeedbackv5-mask-text-hiddensight' => 'This post was oversighted by an authorized editor',
147148 'articlefeedbackv5-mask-postnumber' => 'Post #$1',
148 -
 149+
149150 /* Special page flyover panels */
150151 /* Hide this post panel */
151152 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post',
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js
@@ -477,9 +477,10 @@
478478 .data( 'hidden', true );
479479 $row.find( '.articleFeedbackv5-comment-wrap' ).addClass( 'articleFeedbackv5-h3-push');
480480 $( '<span class="articleFeedbackv5-feedback-hidden-marker"></span>' )
481 - .text( mw.msg( 'articlefeedbackv5-hidden', $hide_user, $hide_timestamp) )
482 - .insertBefore( $row.find( '.articleFeedbackv5-comment-wrap' ) );
483 - $.articleFeedbackv5special.maskPost( $row );
 481+ // this is on purpose html not text- $hide_user is a link
 482+ .html( mw.msg( 'articlefeedbackv5-hidden', $hide_user, $hide_timestamp) )
 483+ .insertBefore( $row.find( '.articleFeedbackv5-comment-wrap-h3' ) );
 484+ $.articleFeedbackv5special.maskPost( $row, 'hidden');
484485 };
485486 // }}}
486487 // {{{ unmarkHidden
@@ -496,7 +497,7 @@
497498 };
498499 // }}}
499500 // {{{ maskPost
500 - $.articleFeedbackv5special.maskPost = function( $row ) {
 501+ $.articleFeedbackv5special.maskPost = function( $row, $type ) {
501502 var $screen = $( $.articleFeedbackv5special.maskHtmlTemplate )
502503 .addClass( 'articleFeedbackv5-post-screen' )
503504 .height( $row.innerHeight() )
@@ -506,7 +507,7 @@
507508 $screen.find( '.articleFeedbackv5-mask-text-wrapper')
508509 .css( 'top', $screen.innerHeight() / 2 - 12 );
509510 $screen.find( '.articleFeedbackv5-mask-text' )
510 - .text( mw.msg( 'articlefeedbackv5-mask-text' ) );
 511+ .text( mw.msg( 'articlefeedbackv5-mask-text-' + $type ) );
511512 $screen.find( '.articleFeedbackv5-mask-postid' )
512513 .text( mw.msg( 'articlefeedbackv5-mask-postnumber', $row.attr( 'rel' ) ) );
513514 $row.prepend( $screen );
@@ -525,10 +526,11 @@
526527 $row.addClass( 'articleFeedbackv5-feedback-deleted' )
527528 .data( 'deleted', true );
528529 var $marker = $( '<span class="articleFeedbackv5-feedback-deleted-marker"></span>' )
529 - .text( mw.msg( 'articlefeedbackv5-deleted', $oversight_user, $oversight_timestamp ) )
 530+ // this is on purpose html not text- $oversight_user is a link
 531+ .html( mw.msg( 'articlefeedbackv5-deleted', $oversight_user, $oversight_timestamp ) )
530532 .insertBefore( $row.find( '.articleFeedbackv5-comment-wrap h3' ) );
531533 $row.find( '.articleFeedbackv5-comment-wrap' ).addClass( 'articleFeedbackv5-h3-push');
532 - $.articleFeedbackv5special.maskPost( $row );
 534+ $.articleFeedbackv5special.maskPost( $row, 'oversight' );
533535 };
534536
535537 // }}}
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php
@@ -83,7 +83,7 @@
8484 }
8585
8686 // This is data for the "hidden by, oversighted by" red line
87 - $results['oversight-user'] = $wgUser->getName();
 87+ $results['oversight-user'] = ApiArticleFeedbackv5Utils::getUserLink($wgUser);
8888 $results['oversight-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp );
8989
9090 // autohide if not hidden
@@ -98,7 +98,7 @@
9999 // tell front-end autohiding was done
100100 $results['autohidden'] = 1;
101101 // This is data for the "hidden by, oversighted by" red line
102 - $results['hide-user'] = 'Article Feedback V5';
 102+ $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink(null, 'Article Feedback V5');
103103 $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp );
104104 }
105105
@@ -130,7 +130,7 @@
131131 $filters = $this->changeFilterCounts( $record, $filters, 'hide' );
132132
133133 // This is data for the "hidden by, oversighted by" red line
134 - $results['hide-user'] = $wgUser->getName();
 134+ $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink($wgUser);
135135 $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp );
136136
137137 } else {
@@ -202,7 +202,7 @@
203203 // tell front-end autohiding was done
204204 $results['autohidden'] = 1;
205205 // This is data for the "hidden by, oversighted by" red line
206 - $results['hide-user'] = 'Article Feedback V5';
 206+ $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink(null, 'Article Feedback V5');
207207 $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp );
208208 }
209209 }
@@ -250,7 +250,7 @@
251251 // tell front-end autohiding was done
252252 $results['autohidden'] = 1;
253253 // This is data for the "hidden by, oversighted by" red line
254 - $results['hide-user'] = 'Article Feedback V5';
 254+ $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink(null, 'Article Feedback V5');
255255 $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp );
256256 }
257257
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
@@ -497,38 +497,14 @@
498498 'rel' => $id
499499 );
500500 if ( $record[0]->af_is_hidden ) {
501 - // if user is 0, we use a fake user
502 - if ($record[0]->af_hide_user_id > 0) {
503 - $user = User::newFromId( $record[0]->af_hide_user_id );
504 - if ($user) {
505 - $name = $user->getName();
506 - }
507 - }
508 - if(!isset($name)) {
509 - $name = 'Article Feedback V5';
510 - }
511501
512 - $attributes['hide-user'] = $name;
513 - if ($record[0]->af_hide_timestamp > 0) {
514 - $attributes['hide-timestamp'] = wfTimestamp( TS_RFC2822, $record[0]->af_hide_timestamp );
515 - }
 502+ $attributes['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink($record[0]->af_hide_user_id, 'Article Feedback V5');
 503+ $attributes['hide-timestamp'] = wfTimestamp( TS_RFC2822, $record[0]->af_hide_timestamp );
516504 }
517505 if ( $record[0]->af_is_deleted ) {
518 - // if user is 0, we use a fake user
519 - if ($record[0]->af_oversight_user_id > 0) {
520 - $user = User::newFromId( $record[0]->af_oversight_user_id );
521 - if ($user) {
522 - $name = $user->getName();
523 - }
524 - }
525 - if(!isset($name)) {
526 - $name = 'Article Feedback V5';
527 - }
528506
529 - $attributes['oversight-user'] = $name;
530 - if ($record[0]->af_oversight_timestamp > 0) {
531 - $attributes['oversight-timestamp'] = wfTimestamp( TS_RFC2822, $record[0]->af_oversight_timestamp );
532 - }
 507+ $attributes['oversight-user'] = ApiArticleFeedbackv5Utils::getUserLink($record[0]->af_oversight_user_id, 'Article Feedback V5');
 508+ $attributes['oversight-timestamp'] = wfTimestamp( TS_RFC2822, $record[0]->af_oversight_timestamp );
533509 }
534510
535511 return Html::openElement( 'div', $attributes )
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php
@@ -269,5 +269,34 @@
270270
271271 $dbw->commit();
272272 }
 273+
 274+ /**
 275+ * Creates a user link for a log row
 276+ *
 277+ * @param int $user_id can be null or a user object
 278+ * @param string $user_ip (name works too)
 279+ * @return anchor tag link to user
 280+ */
 281+ public static function getUserLink($user_id, $user_ip = null) {
 282+ // if $user is not an object
 283+ if ( !($user_id instanceof User) ){
 284+ $userId = (int) $user_id;
 285+ if ( $userId !== 0 ) { // logged-in users
 286+ $user = User::newFromId( $userId );
 287+ } else { // IP users
 288+ $userText = $user_ip;
 289+ $user = User::newFromName( $userText, false );
 290+ }
 291+ } else {
 292+ // user is an object, all good, make link
 293+ $user = $user_id;
 294+ }
 295+
 296+ $element = Linker::userLink(
 297+ $user->getId(),
 298+ $user->getName()
 299+ );
 300+ return $element;
 301+ }
273302 }
274303
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewActivityArticleFeedbackv5.php
@@ -85,7 +85,7 @@
8686 $html .= Html::openElement( 'div', array() );
8787 $html .= wfMessage( 'articlefeedbackv5-activity-feedback-info',
8888 array($feedback->af_id))
89 - ->rawParams($this->getUserLink($feedback->af_user_id, $feedback->af_user_ip))
 89+ ->rawParams(ApiArticleFeedbackv5Utils::getUserLink($feedback->af_user_id, $feedback->af_user_ip))
9090 ->text();
9191 $html .= Html::closeElement( 'div' );
9292
@@ -153,7 +153,7 @@
154154 if ($item->log_comment == '') {
155155 $html .= wfMessage( 'articlefeedbackv5-activity-item' )
156156 ->rawParams(
157 - $this->getUserLink($item->log_user, $item->log_user_text),
 157+ ApiArticleFeedbackv5Utils::getUserLink($item->log_user, $item->log_user_text),
158158 Html::element( 'span', array(
159159 'class' => 'articleFeedbackv5-activity-item-action'
160160 ),
@@ -164,7 +164,7 @@
165165 } else {
166166 $html .= wfMessage( 'articlefeedbackv5-activity-item-comment' )
167167 ->rawParams(
168 - $this->getUserLink($item->log_user, $item->log_user_text),
 168+ ApiArticleFeedbackv5Utils::getUserLink($item->log_user, $item->log_user_text),
169169 Html::element( 'span', array(
170170 'class' => 'articleFeedbackv5-activity-item-action'
171171 ),
@@ -345,28 +345,6 @@
346346 }
347347
348348 /**
349 - * Creates a user link for a log row
350 - *
351 - * @param stdClass $item row from log table db
352 - * @return string the SVN version info
353 - */
354 - protected function getUserLink($user_id, $user_ip) {
355 - $userId = (int) $user_id;
356 - if ( $userId !== 0 ) { // logged-in users
357 - $user = User::newFromId( $userId );
358 - } else { // IP users
359 - $userText = $user_ip;
360 - $user = User::newFromName( $userText, false );
361 - }
362 -
363 - $element = Linker::userLink(
364 - $user->getId(),
365 - $user->getName()
366 - );
367 - return $element;
368 - }
369 -
370 - /**
371349 * Creates a timestamp/id tuple for continue
372350 */
373351 protected function getContinue( $row ) {
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -231,7 +231,8 @@
232232 'articlefeedbackv5-noteflyover-declineoversight-help',
233233 'articlefeedbackv5-noteflyover-declineoversight-help-link',
234234
235 - 'articlefeedbackv5-mask-text',
 235+ 'articlefeedbackv5-mask-text-hidden',
 236+ 'articlefeedbackv5-mask-text-oversight',
236237 'articlefeedbackv5-mask-postnumber'
237238 ),
238239 'dependencies' => array(

Follow-up revisions

RevisionCommit summaryAuthorDate
r113371bug 34090 - fixes for oversighter view for hide/oversight panelsemsmith17:51, 8 March 2012
r113383bug 34090 - not entirely necessary, but keeps $2 from showing up in hiders pa...emsmith19:25, 8 March 2012
r113384bug 34090 - fix for double red line issues when hiding an oversighted post ha...emsmith19:28, 8 March 2012
r113390bug 34090 - adding translation for "automatic hider" useremsmith19:44, 8 March 2012
r113392bug 34090 - followup to r113287 - adjusted localization documentationemsmith20:03, 8 March 2012
r113393bug 34090 - followup to r113370 - adjusted localization documentationemsmith20:05, 8 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111211bug 34090 - Added a log namespace and log types for the Article Feedback v5 e...emsmith22:53, 10 February 2012
r111472bug 34090 - Added an additional column in the main feedback table to keep a c...emsmith19:14, 14 February 2012
r111474bug 34090 - remove a todo - take the note from the flag submission and save i...emsmith19:57, 14 February 2012
r111552bug 34090 - split activity notes into their own config for maximum length (th...emsmith16:07, 15 February 2012
r111557bug 34090 - changed structure of the link classes and ids per the following f...emsmith16:47, 15 February 2012
r111570bug 34090 - request oversight is now a counter - so you can request/unrequest...emsmith19:53, 15 February 2012
r111573bug 34090 - removed the "header" portion of the html generation from the acti...emsmith20:18, 15 February 2012
r111645bug 34090 - updated the filter count update script to get requested oversight...emsmith15:45, 16 February 2012
r112038bug 34090 - added additional counts for filters including unhidden, undeleted...emsmith20:28, 21 February 2012
r112039bug 34090 - fixed issue noted : if $feedback is false return nothing - not th...emsmith20:50, 21 February 2012
r112041bug 34090 - kill the -1 issue by never letting it get below 0emsmith21:08, 21 February 2012
r112115bug 34090 - no code changes, just fixing/adding keyword svn propertiesemsmith16:31, 22 February 2012
r112119bug 34090 - cast the naughty column so it can be signed, the greatest still k...emsmith16:57, 22 February 2012
r112142bug 34090 - toggle for atomic un/helpful changing (and elimination of an extr...emsmith20:37, 22 February 2012
r112147bug 34090 - note to self, watch the copy and paste errors...emsmith21:01, 22 February 2012
r112149bug 34090 - no upper limit, only lower limit - we can't get any worse then 0emsmith21:21, 22 February 2012
r112154bug 34090 - quick and dirty helper script to get missing documentation keysemsmith21:57, 22 February 2012
r112156bug 34090 - only send the activity header if continue < 1, make the more div ...emsmith22:14, 22 February 2012
r112161bug 34090 - fix limit and use old continue to determine if we do the headeremsmith23:15, 22 February 2012
r112218bug 34090 - make sure the name are right for hidden/unhidden logging (argh)emsmith16:44, 23 February 2012
r112225bug 34090 - unhidden and unoversight logic adjustmentsemsmith18:06, 23 February 2012
r112228bug 34090 - fix filter - needsoversight are always autohiddenemsmith19:16, 23 February 2012
r112230bug 34090 - let's try this again - needsoversight and declined will have hidd...emsmith19:38, 23 February 2012
r112232bug 34090 - hide and show shouldn't fiddle with oversight counts or declined ...emsmith19:48, 23 February 2012
r112599bug 34090 - follow up to r111211 - rename things to make them "less confusin...emsmith14:43, 28 February 2012
r112603bug 34090 - Add the logging of automated hide/show errors by the "Article Fee...emsmith15:21, 28 February 2012
r112604bug 34090 - can't believe there were no permissions checks in this - only del...emsmith15:38, 28 February 2012
r112610bug 34090 - change all sql updates to use escaping except for explicitly comm...emsmith16:22, 28 February 2012
r112611bug 34090 - take out implicit show and add returning user that hid/oversighte...emsmith17:02, 28 February 2012
r112627bug 34090 - follow up to r112599 - change to use getText since it's going int...emsmith18:53, 28 February 2012
r112825bug 34090 - insert custom attributes (sigh) for the user and formatted timest...emsmith18:14, 1 March 2012
r112830bug 34090 - follow up to r111474 - use truncate for choppingemsmith19:42, 1 March 2012
r113052bug 34090 - remaining backend feature in requirements, oversight email genera...emsmith18:04, 5 March 2012
r113062bug 34090 - follow up to r110520 1. change index 2. default of null for conti...emsmith18:54, 5 March 2012
r113073bug 34090 - follow up to r111472 part 1 - change to use getDbKey, check for b...emsmith19:48, 5 March 2012
r113082bug 34090 - follow up to r111471 - changed to use text()emsmith20:42, 5 March 2012
r113083bug 34090 - follow up to rr111472 part 2 - only use log_id for orderingemsmith20:48, 5 March 2012
r113104bug 34090 - follow up to rr111472 part 3 - totally redo the continue function...emsmith23:10, 5 March 2012
r113159bug 34090 - follow up to rr111472 part 4 and follow up to r111596 (same issue...emsmith17:37, 6 March 2012
r113160bug 34090 - follow up to rr111472 part 5 plural and number format action countemsmith17:48, 6 March 2012
r113161bug 34090 - follow up to rr111472 part 6 last of lego messagesemsmith17:53, 6 March 2012
r113163bug 34090 - two additional configuration settings (help url and admin user ur...emsmith18:02, 6 March 2012
r113193bug 34090 - followup to r113104 - only sort by timestamp (sorting by log id w...emsmith22:56, 6 March 2012
r113228bug 34090 - followup to r113160emsmith14:05, 7 March 2012
r113247bug 34090 - db issue, remove one of the sorts from the query, use the ids arr...emsmith16:52, 7 March 2012
r113269bug 34090 - followup to r113247emsmith19:01, 7 March 2012
r113273bug 34090 - add javascript level hiding on request oversight IF autohidden is...emsmith19:22, 7 March 2012
r113287bug 34090 - usernames and formatted timestamps into red lines for hidden/over...emsmith20:22, 7 March 2012
r113311bug 34090 - fixing the username bugs - apparently using the data- stuff with ...emsmith22:34, 7 March 2012
r113317bug 34090 - js and css voodoo to make the element with the red lines appear a...emsmith23:01, 7 March 2012

Comments

#Comment by Amire80 (talk | contribs)   16:55, 8 March 2012

Please document the i18n messages under the qqq language.

Status & tagging log