Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -142,9 +142,10 @@ |
143 | 143 | 'articlefeedbackv5-timestamp-months' => '{{PLURAL:$1|$1 month|$1 months}}', |
144 | 144 | 'articlefeedbackv5-timestamp-weeks' => '{{PLURAL:$1|$1 week|$1 weeks}}', |
145 | 145 | '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', |
147 | 148 | 'articlefeedbackv5-mask-postnumber' => 'Post #$1', |
148 | | - |
| 149 | + |
149 | 150 | /* Special page flyover panels */ |
150 | 151 | /* Hide this post panel */ |
151 | 152 | 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -477,9 +477,10 @@ |
478 | 478 | .data( 'hidden', true ); |
479 | 479 | $row.find( '.articleFeedbackv5-comment-wrap' ).addClass( 'articleFeedbackv5-h3-push'); |
480 | 480 | $( '<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'); |
484 | 485 | }; |
485 | 486 | // }}} |
486 | 487 | // {{{ unmarkHidden |
— | — | @@ -496,7 +497,7 @@ |
497 | 498 | }; |
498 | 499 | // }}} |
499 | 500 | // {{{ maskPost |
500 | | - $.articleFeedbackv5special.maskPost = function( $row ) { |
| 501 | + $.articleFeedbackv5special.maskPost = function( $row, $type ) { |
501 | 502 | var $screen = $( $.articleFeedbackv5special.maskHtmlTemplate ) |
502 | 503 | .addClass( 'articleFeedbackv5-post-screen' ) |
503 | 504 | .height( $row.innerHeight() ) |
— | — | @@ -506,7 +507,7 @@ |
507 | 508 | $screen.find( '.articleFeedbackv5-mask-text-wrapper') |
508 | 509 | .css( 'top', $screen.innerHeight() / 2 - 12 ); |
509 | 510 | $screen.find( '.articleFeedbackv5-mask-text' ) |
510 | | - .text( mw.msg( 'articlefeedbackv5-mask-text' ) ); |
| 511 | + .text( mw.msg( 'articlefeedbackv5-mask-text-' + $type ) ); |
511 | 512 | $screen.find( '.articleFeedbackv5-mask-postid' ) |
512 | 513 | .text( mw.msg( 'articlefeedbackv5-mask-postnumber', $row.attr( 'rel' ) ) ); |
513 | 514 | $row.prepend( $screen ); |
— | — | @@ -525,10 +526,11 @@ |
526 | 527 | $row.addClass( 'articleFeedbackv5-feedback-deleted' ) |
527 | 528 | .data( 'deleted', true ); |
528 | 529 | 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 ) ) |
530 | 532 | .insertBefore( $row.find( '.articleFeedbackv5-comment-wrap h3' ) ); |
531 | 533 | $row.find( '.articleFeedbackv5-comment-wrap' ).addClass( 'articleFeedbackv5-h3-push'); |
532 | | - $.articleFeedbackv5special.maskPost( $row ); |
| 534 | + $.articleFeedbackv5special.maskPost( $row, 'oversight' ); |
533 | 535 | }; |
534 | 536 | |
535 | 537 | // }}} |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | } |
85 | 85 | |
86 | 86 | // This is data for the "hidden by, oversighted by" red line |
87 | | - $results['oversight-user'] = $wgUser->getName(); |
| 87 | + $results['oversight-user'] = ApiArticleFeedbackv5Utils::getUserLink($wgUser); |
88 | 88 | $results['oversight-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
89 | 89 | |
90 | 90 | // autohide if not hidden |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | // tell front-end autohiding was done |
100 | 100 | $results['autohidden'] = 1; |
101 | 101 | // 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'); |
103 | 103 | $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
104 | 104 | } |
105 | 105 | |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | $filters = $this->changeFilterCounts( $record, $filters, 'hide' ); |
132 | 132 | |
133 | 133 | // This is data for the "hidden by, oversighted by" red line |
134 | | - $results['hide-user'] = $wgUser->getName(); |
| 134 | + $results['hide-user'] = ApiArticleFeedbackv5Utils::getUserLink($wgUser); |
135 | 135 | $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
136 | 136 | |
137 | 137 | } else { |
— | — | @@ -202,7 +202,7 @@ |
203 | 203 | // tell front-end autohiding was done |
204 | 204 | $results['autohidden'] = 1; |
205 | 205 | // 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'); |
207 | 207 | $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
208 | 208 | } |
209 | 209 | } |
— | — | @@ -250,7 +250,7 @@ |
251 | 251 | // tell front-end autohiding was done |
252 | 252 | $results['autohidden'] = 1; |
253 | 253 | // 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'); |
255 | 255 | $results['hide-timestamp'] = wfTimestamp( TS_RFC2822, $timestamp ); |
256 | 256 | } |
257 | 257 | |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -497,38 +497,14 @@ |
498 | 498 | 'rel' => $id |
499 | 499 | ); |
500 | 500 | 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 | | - } |
511 | 501 | |
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 ); |
516 | 504 | } |
517 | 505 | 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 | | - } |
528 | 506 | |
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 ); |
533 | 509 | } |
534 | 510 | |
535 | 511 | return Html::openElement( 'div', $attributes ) |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5Utils.php |
— | — | @@ -269,5 +269,34 @@ |
270 | 270 | |
271 | 271 | $dbw->commit(); |
272 | 272 | } |
| 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 | + } |
273 | 302 | } |
274 | 303 | |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewActivityArticleFeedbackv5.php |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | $html .= Html::openElement( 'div', array() ); |
87 | 87 | $html .= wfMessage( 'articlefeedbackv5-activity-feedback-info', |
88 | 88 | 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)) |
90 | 90 | ->text(); |
91 | 91 | $html .= Html::closeElement( 'div' ); |
92 | 92 | |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | if ($item->log_comment == '') { |
155 | 155 | $html .= wfMessage( 'articlefeedbackv5-activity-item' ) |
156 | 156 | ->rawParams( |
157 | | - $this->getUserLink($item->log_user, $item->log_user_text), |
| 157 | + ApiArticleFeedbackv5Utils::getUserLink($item->log_user, $item->log_user_text), |
158 | 158 | Html::element( 'span', array( |
159 | 159 | 'class' => 'articleFeedbackv5-activity-item-action' |
160 | 160 | ), |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | } else { |
166 | 166 | $html .= wfMessage( 'articlefeedbackv5-activity-item-comment' ) |
167 | 167 | ->rawParams( |
168 | | - $this->getUserLink($item->log_user, $item->log_user_text), |
| 168 | + ApiArticleFeedbackv5Utils::getUserLink($item->log_user, $item->log_user_text), |
169 | 169 | Html::element( 'span', array( |
170 | 170 | 'class' => 'articleFeedbackv5-activity-item-action' |
171 | 171 | ), |
— | — | @@ -345,28 +345,6 @@ |
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
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 | | - /** |
371 | 349 | * Creates a timestamp/id tuple for continue |
372 | 350 | */ |
373 | 351 | protected function getContinue( $row ) { |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -231,7 +231,8 @@ |
232 | 232 | 'articlefeedbackv5-noteflyover-declineoversight-help', |
233 | 233 | 'articlefeedbackv5-noteflyover-declineoversight-help-link', |
234 | 234 | |
235 | | - 'articlefeedbackv5-mask-text', |
| 235 | + 'articlefeedbackv5-mask-text-hidden', |
| 236 | + 'articlefeedbackv5-mask-text-oversight', |
236 | 237 | 'articlefeedbackv5-mask-postnumber' |
237 | 238 | ), |
238 | 239 | 'dependencies' => array( |