r109952 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109951‎ | r109952 | r109953 >
Date:21:12, 24 January 2012
Author:gregchiasson
Status:ok
Tags:aft 
Comment:
AFT5 feedback page - Fix request oversight/remove oversight request links. Add filter for oversight-requested feedback.
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.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
@@ -61,6 +61,7 @@
6262 'articlefeedbackv5-special-filter-abusive' => 'Abusive ($1)',
6363 'articlefeedbackv5-special-filter-helpful' => 'Helpful ($1)',
6464 'articlefeedbackv5-special-filter-unhelpful' => 'Unhelpful ($1)',
 65+ 'articlefeedbackv5-special-filter-needsoversight' => ' Oversight requested ($1)',
6566 'articlefeedbackv5-special-filter-visible' => 'Visible ($1)',
6667 'articlefeedbackv5-special-filter-invisible' => 'Hidden ($1)',
6768 'articlefeedbackv5-special-filter-deleted' => 'Deleted ($1)',
@@ -80,12 +81,14 @@
8182 'articlefeedbackv5-special-pagetitle' => 'Feedback: $1',
8283
8384 'articlefeedbackv5-form-optionid' => 'Option $1',
 85+ 'articlefeedbackv5-hidden' => 'Hidden',
8486 'articlefeedbackv5-form-hide' => 'Hide this post ($1)',
8587 'articlefeedbackv5-form-unhide' => 'Show this post',
8688 'articlefeedbackv5-form-helpful' => 'Mark as helpful ($1)',
8789 'articlefeedbackv5-form-abuse' => 'Flag as abuse ($1)',
8890 'articlefeedbackv5-form-delete' => 'Delete',
89 - 'articlefeedbackv5-form-oversight' => 'Mark for oversight',
 91+ 'articlefeedbackv5-form-oversight' => 'Request oversight',
 92+ 'articlefeedbackv5-form-unoversight' => 'Unmark for oversight',
9093 'articlefeedbackv5-form-undelete' => 'Show this post',
9194 'articlefeedbackv5-form-header' => 'Feedback #$1, at $2',
9295 'articlefeedbackv5-form1-header-found' => '{{GENDER:$1|$1}} found what they were looking for:',
@@ -107,6 +110,7 @@
108111 'articlefeedbackv5-unhide-saved' => 'Feedback shown',
109112 'articlefeedbackv5-undelete-saved' => 'Feedback shown',
110113 'articlefeedbackv5-oversight-saved' => 'Marked for oversight',
 114+ 'articlefeedbackv5-unoversight-saved' => 'Oversight flag removed',
111115 'articlefeedbackv5-error-loading-feedback' => 'Error loading feedback',
112116 'articlefeedbackv5-invalid-feedback-id' => 'Invalid feedback ID',
113117 'articlefeedbackv5-invalid-feedback-flag' => 'Invalid feedback flag',
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js
@@ -140,12 +140,12 @@
141141 return false;
142142 } );
143143
144 - $.each( ['unhide', 'undelete', 'oversight', 'hide', 'abuse', 'delete', 'helpful', 'unhelpful'],
 144+ $.each( ['unhide', 'undelete', 'oversight', 'hide', 'abuse', 'delete', 'helpful', 'unhelpful', 'unoversight'],
145145 function ( index, value ) {
146146 $( '.articleFeedbackv5-' + value + '-link' ).live( 'click', function( e ) {
147147 $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-' + value + '-link-' ), value );
148 - })
149 - });
 148+ } )
 149+ } );
150150 }
151151
152152 // }}}
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php
@@ -51,7 +51,7 @@
5252 $update[] = 'af_needs_oversight = FALSE';
5353 } elseif( $params['flagtype'] == 'oversight' ) {
5454 // flag for oversight
55 - $update[] = 'af_oversight = TRUE';
 55+ $update[] = 'af_needs_oversight = TRUE';
5656 } elseif( in_array( $params['flagtype'], $flags ) ) {
5757 // Probably this doesn't need validation, since the API
5858 // will handle it, but if it's getting interpolated into
@@ -182,7 +182,7 @@
183183 ApiBase::PARAM_REQUIRED => true,
184184 ApiBase::PARAM_ISMULTI => false,
185185 ApiBase::PARAM_TYPE => array(
186 - 'abuse', 'hide', 'helpful', 'unhelpful', 'delete', 'undelete', 'unhide', 'oversight' )
 186+ 'abuse', 'hide', 'helpful', 'unhelpful', 'delete', 'undelete', 'unhide', 'oversight', 'unoversight' )
187187 ),
188188 );
189189 }
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php
@@ -156,7 +156,8 @@
157157 'aa_response_rating', 'aa_response_option_id',
158158 'afi_data_type', 'af_created', 'user_name',
159159 'af_user_ip', 'af_hide_count', 'af_abuse_count',
160 - 'af_helpful_count', 'af_unhelpful_count', 'af_delete_count',
 160+ 'af_helpful_count', 'af_unhelpful_count',
 161+ 'af_delete_count', 'af_needs_oversight',
161162 '(SELECT COUNT(*) FROM revision WHERE rev_id > af_revision_id AND rev_page = '.( integer ) $pageId.') AS age',
162163 'CONVERT(af_helpful_count, SIGNED) - CONVERT(af_unhelpful_count, SIGNED) AS net_helpfulness',
163164 'page_latest', 'af_revision_id', 'page_title'
@@ -222,9 +223,12 @@
223224 }
224225
225226 switch( $filter ) {
 227+ case 'needsoversight':
 228+ $where[] = 'af_needs_oversight IS TRUE';
 229+ break;
226230 case 'id':
227231 # Used for permalinks.
228 - $where[ 'af_id' ] = $filterValue;
 232+ $where['af_id'] = $filterValue;
229233 break;
230234 case 'all':
231235 # relies on the above to handler filtering,
@@ -368,6 +372,7 @@
369373 if( $record[0]->af_hide_count > 0 ) {
370374 # unhide
371375 $link = 'unhide';
 376+ $tools .= Html::element( 'li', array(), wfMessage( 'articlefeedbackv5-hidden' ) );
372377 }
373378 $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array(
374379 'id' => "articleFeedbackv5-$link-link-$id",
@@ -375,28 +380,38 @@
376381 ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_hide_count )->text() ) );
377382 }
378383
379 - # TODO: a third link, to remove oversight flag
380384 if( $can_delete ) {
381385 # delete
382386 $link = 'delete';
383387 if( $record[0]->af_delete_count > 0 ) {
384 - # undelete
385388 $link = 'undelete';
386389 }
387 -# } else {
388 -# if( $record[0]->af_needs_oversight ) {
389 -# # TODO: already flagged
390 -# $link = 'oversight';
391 -# }
392 -# # flag for oversight
393 -# $link = 'oversight';
 390+ $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array(
 391+ 'id' => "articleFeedbackv5-$link-link-$id",
 392+ 'class' => "articleFeedbackv5-$link-link"
 393+ ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_delete_count )->text() ) );
394394 }
395395
396 - $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array(
397 - 'id' => "articleFeedbackv5-$link-link-$id",
398 - 'class' => "articleFeedbackv5-$link-link"
399 - ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_delete_count )->text() ) )
400 - . Html::closeElement( 'ul' )
 396+ $link = null;
 397+ if( $record[0]->af_needs_oversight ) {
 398+ if( $can_delete ) {
 399+ $link = 'unoversight';
 400+ } else {
 401+ $link = 'oversighted';
 402+ }
 403+ } elseif( $can_hide ) {
 404+ # flag for oversight
 405+ $link = 'oversight';
 406+ }
 407+
 408+ if( $link ) {
 409+ $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array(
 410+ 'id' => "articleFeedbackv5-$link-link-$id",
 411+ 'class' => "articleFeedbackv5-$link-link"
 412+ ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_delete_count )->text() ) );
 413+ }
 414+
 415+ $tools .= Html::closeElement( 'ul' )
401416 . Html::closeElement( 'div' );
402417 }
403418
@@ -555,7 +570,7 @@
556571 ApiBase::PARAM_REQUIRED => false,
557572 ApiBase::PARAM_ISMULTI => false,
558573 ApiBase::PARAM_TYPE => array(
559 - 'all', 'invisible', 'visible', 'comment', 'id', 'helpful', 'unhelpful', 'abusive', 'deleted' )
 574+ 'all', 'invisible', 'visible', 'comment', 'id', 'helpful', 'unhelpful', 'abusive', 'deleted', 'needsoversight' )
560575 ),
561576 'filtervalue' => array(
562577 ApiBase::PARAM_REQUIRED => false,
Index: trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php
@@ -41,7 +41,7 @@
4242
4343 if( $wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) {
4444 array_push( $this->filters,
45 - 'invisible', 'unhelpful', 'abusive'
 45+ 'invisible', 'unhelpful', 'abusive', 'needsoversight'
4646 );
4747 }
4848
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -167,12 +167,14 @@
168168 'articlefeedbackv5-invalid-feedback-flag',
169169 'articlefeedbackv5-abuse-saved',
170170 'articlefeedbackv5-hide-saved',
 171+ 'articlefeedbackv5-hidden',
171172 'articlefeedbackv5-delete-saved',
172173 'articlefeedbackv5-helpful-saved',
173174 'articlefeedbackv5-unhelpful-saved',
174175 'articlefeedbackv5-unhide-saved',
175176 'articlefeedbackv5-undelete-saved',
176177 'articlefeedbackv5-oversight-saved',
 178+ 'articlefeedbackv5-unoversight-saved',
177179 'articlefeedbackv5-comment-link',
178180 'articlefeedbackv5-special-sort-asc',
179181 'articlefeedbackv5-special-sort-desc'

Status & tagging log