Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -54,7 +54,8 @@ |
55 | 55 | 'articlefeedbackv5-form-helpful-no-label' => 'No', |
56 | 56 | 'articlefeedbackv5-form-helpful-votes' => '{{PLURAL:$1|1 yes|$1 yes}} / {{PLURAL:$2|1 no|$2 no}}', |
57 | 57 | 'articlefeedbackv5-special-add-feedback' => 'Add your feedback', |
58 | | - 'articlefeedbackv5-special-filter-all' => 'All ($1)', |
| 58 | + 'articlefeedbackv5-special-filter-all' => 'All (oversight) ($1)', |
| 59 | + 'articlefeedbackv5-special-filter-notdeleted' => 'All ($1)', |
59 | 60 | 'articlefeedbackv5-special-filter-comment' => 'Comments only ($1)', |
60 | 61 | 'articlefeedbackv5-special-filter-abusive' => 'Flagged as abuse ($1)', |
61 | 62 | 'articlefeedbackv5-special-filter-helpful' => 'Helpful ($1)', |
— | — | @@ -91,7 +92,7 @@ |
92 | 93 | 'articlefeedbackv5-form-header' => 'Feedback #$1, at $2', |
93 | 94 | 'articlefeedbackv5-form1-header-found' => '{{GENDER:$1|$1}} found what they were looking for', |
94 | 95 | 'articlefeedbackv5-form1-header-not-found' => '{{GENDER:$1|$1}} did not find what they were looking for', |
95 | | - 'articlefeedbackv5-form1-header-left-comment' => '{{GENDER:$1|$1}} left a comment', |
| 96 | + 'articlefeedbackv5-form1-header-left-comment' => '{{GENDER:$1|$1}} posted this comment', |
96 | 97 | 'articlefeedbackv5-form2-header-praise' => '{{GENDER:$1|$1}} had a praise:', |
97 | 98 | 'articlefeedbackv5-form2-header-problem' => '{{GENDER:$1|$1}} had a problem:', |
98 | 99 | 'articlefeedbackv5-form2-header-question' => '{{GENDER:$1|$1}} had a question:', |
— | — | @@ -320,7 +321,8 @@ |
321 | 322 | 'articlefeedbackv5-form-tools-label' => '{{Identical|Tools}}', |
322 | 323 | 'articlefeedbackv5-form-helpful-yes-label' => '{{Identical|Yes}}', |
323 | 324 | 'articlefeedbackv5-form-helpful-no-label' => '{{Identical|No}}', |
324 | | - 'articlefeedbackv5-special-filter-all' => '{{Identical|All}}', |
| 325 | + 'articlefeedbackv5-special-filter-all' => 'Shows all records, including ones that have been deleted or flagged for oversight.', |
| 326 | + 'articlefeedbackv5-special-filter-notdeleted' => '{{Identical|All}}', |
325 | 327 | 'articlefeedbackv5-special-filter-comment' => 'Feedback with text comments', |
326 | 328 | 'articlefeedbackv5-special-filter-abusive' => '{{Identical|Abusive}}', |
327 | 329 | 'articlefeedbackv5-special-filter-helpful' => 'Feedback that has been marked as helpful', |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -231,38 +231,22 @@ |
232 | 232 | |
233 | 233 | private function getFilterCriteria( $filter, $filterValue = null ) { |
234 | 234 | global $wgUser; |
235 | | - $where = array(); |
| 235 | + $where = array(); |
| 236 | + $hiddenFilters = array( 'invisible', 'notdeleted', 'all', 'deleted' ); |
| 237 | + $deletedFilters = array( 'all', 'deleted' ); |
236 | 238 | |
237 | | - // Permissions check: these filters are for admins only. |
238 | | - if ( |
239 | | - ( $filter == 'invisible' |
240 | | - && !$wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) |
241 | | - || |
242 | | - ( $filter == 'deleted' |
243 | | - && !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) |
244 | | - ) { |
245 | | - $filter = null; |
246 | | - } |
247 | | - |
248 | | - // Don't let non-allowed users see these. |
249 | | - if ( !$wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
250 | | - $where[] = 'af_is_hidden IS FALSE'; |
251 | | - } |
252 | | - |
253 | | - // Don't let non-allowed users see these. |
254 | | - if ( !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
| 239 | + // Never show hidden or deleted posts unless specifically requested |
| 240 | + // and user has access. |
| 241 | + if( !in_array( $filter, $deletedFilters ) |
| 242 | + || !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
255 | 243 | $where[] = 'af_is_deleted IS FALSE'; |
256 | 244 | } |
257 | 245 | |
258 | | - // Never show hidden or deleted posts unless specifically requested. |
259 | | - if( $filter != 'invisible' && $filter != 'deleted' ) { |
| 246 | + if( !in_array( $filter, $hiddenFilters ) |
| 247 | + || !$wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
260 | 248 | $where[] = 'af_is_hidden IS FALSE'; |
261 | 249 | } |
262 | 250 | |
263 | | - if( $filter != 'deleted' ) { |
264 | | - $where[] = 'af_is_deleted IS FALSE'; |
265 | | - } |
266 | | - |
267 | 251 | switch ( $filter ) { |
268 | 252 | case 'needsoversight': |
269 | 253 | $where[] = 'af_needs_oversight IS TRUE'; |
— | — | @@ -503,19 +487,21 @@ |
504 | 488 | } |
505 | 489 | |
506 | 490 | private function renderBucket1( $record ) { |
507 | | - if ( $record['found']->aa_response_boolean ) { |
| 491 | + if ( $record['found']->aa_response_boolean == 1 ) { |
508 | 492 | $msg = 'articlefeedbackv5-form1-header-found'; |
509 | 493 | $class = 'positive'; |
510 | | - } else { |
| 494 | + } elseif( $record['found']->aa_response_boolean !== null ) { |
511 | 495 | $msg = 'articlefeedbackv5-form1-header-not-found'; |
512 | 496 | $class = 'negative'; |
| 497 | + } else { |
| 498 | + $msg = 'articlefeedbackv5-form1-header-left-comment'; |
| 499 | + $class = ''; |
513 | 500 | } |
514 | 501 | |
515 | 502 | return $this->feedbackHead( $msg, $class, $record[0] ) |
516 | 503 | . $this->renderComment( $record['comment']->aa_response_text, $record[0]->af_id ); |
517 | 504 | } |
518 | 505 | |
519 | | - |
520 | 506 | private function renderBucket2( $record ) { |
521 | 507 | $type = htmlspecialchars( $record['tag']->afo_name ); |
522 | 508 | $class = $type == 'problem' ? 'negative' : 'positive'; |
— | — | @@ -679,7 +665,7 @@ |
680 | 666 | ApiBase::PARAM_REQUIRED => false, |
681 | 667 | ApiBase::PARAM_ISMULTI => false, |
682 | 668 | ApiBase::PARAM_TYPE => array( |
683 | | - 'all', 'invisible', 'visible', 'comment', 'id', 'helpful', 'unhelpful', 'abusive', 'deleted', 'needsoversight' ) |
| 669 | + 'all', 'notdeleted', 'invisible', 'visible', 'comment', 'id', 'helpful', 'unhelpful', 'abusive', 'deleted', 'needsoversight' ) |
684 | 670 | ), |
685 | 671 | 'filtervalue' => array( |
686 | 672 | ApiBase::PARAM_REQUIRED => false, |
Index: trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php |
— | — | @@ -33,22 +33,34 @@ |
34 | 34 | global $wgUser; |
35 | 35 | parent::__construct( 'ArticleFeedbackv5' ); |
36 | 36 | |
37 | | - // NOTE: The 'all' option actually displays different things |
38 | | - // based on the users role, which is handled in the filter: |
39 | | - // - deleter-all is actually everything |
40 | | - // - hidder-all is 'visible + hidden' |
41 | | - // - regular non-admin all is just 'all visible' |
| 37 | + $showHidden = $wgUser->isAllowed( 'aftv5-see-hidden-feedback' ); |
| 38 | + $showDeleted = $wgUser->isAllowed( 'aftv5-see-deleted-feedback' ); |
42 | 39 | |
43 | | - if ( $wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
| 40 | + if ( $showHidden ) { |
44 | 41 | array_push( $this->filters, |
45 | 42 | 'unhelpful', 'abusive', 'invisible' |
46 | 43 | ); |
47 | 44 | # removing the 'needsoversight' filter, per Fabrice |
48 | 45 | } |
49 | 46 | |
50 | | - if ( $wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
| 47 | + if ( $showDeleted ) { |
51 | 48 | $this->filters[] = 'deleted'; |
52 | 49 | } |
| 50 | + |
| 51 | + // NOTE: The 'all' option actually displays different things |
| 52 | + // based on the users role, which is handled in the filter: |
| 53 | + // - deleter's all is actually everything |
| 54 | + // - hidder's all is 'visible + hidden' |
| 55 | + // - regular non-admin only has 'all visible' not 'all' |
| 56 | + |
| 57 | + // The all option, if any, is only added once, at the end of the list, |
| 58 | + // which is why it's down here instead. |
| 59 | + if ( $showDeleted ) { |
| 60 | + $this->filters[] = 'all'; |
| 61 | + } elseif( $showHidden ) { |
| 62 | + $this->filters[] = 'notdeleted'; |
| 63 | + } |
| 64 | + $this->filters[] = 'notdeleted'; |
53 | 65 | } |
54 | 66 | |
55 | 67 | /** |