Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -403,6 +403,9 @@ |
404 | 404 | } else { |
405 | 405 | $l.removeClass( 'abusive' ); |
406 | 406 | } |
| 407 | + if ( data['articlefeedbackv5-flag-feedback']['abuse-hidden'] ) { |
| 408 | + $l.parents( '.articleFeedbackv5-feedback' ).hide( 'slow' ); |
| 409 | + } |
407 | 410 | } else { |
408 | 411 | msg = 'articlefeedbackv5-' + type + '-saved'; |
409 | 412 | $( '#articleFeedbackv5-' + type + '-link-' + id ).text( mw.msg( msg ) ); |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php |
— | — | @@ -161,6 +161,15 @@ |
162 | 162 | $wgArticleFeedbackv5AbusiveThreshold = 3; |
163 | 163 | |
164 | 164 | /** |
| 165 | + * Hide abuse threshold |
| 166 | + * |
| 167 | + * After this many users flag a comment as abusive, it is hidden. |
| 168 | + * |
| 169 | + * @var int |
| 170 | + */ |
| 171 | +$wgArticleFeedbackv5HideAbuseThreshold = 5; |
| 172 | + |
| 173 | +/** |
165 | 174 | * Temporary hack: for now, only one CTA is allowed, so set it here. |
166 | 175 | * |
167 | 176 | * Allowed values: '0' (just a confirm message), '1' (call to edit), '2' (learn |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php |
— | — | @@ -167,25 +167,28 @@ |
168 | 168 | } |
169 | 169 | |
170 | 170 | // Conditional formatting for abuse flag |
| 171 | + global $wgArticleFeedbackv5AbusiveThreshold, |
| 172 | + $wgArticleFeedbackv5HideAbuseThreshold; |
171 | 173 | // Re-fetch record - as above, from read/slave DB. |
172 | 174 | // The record could have had it's falg increased or |
173 | 175 | // decreased, so load a fresh (as fresh as the read |
174 | 176 | // db is, anyway) copy of it. |
175 | 177 | $record = $this->fetchRecord( $params['feedbackid'] ); |
176 | | - if( $record->af_abuse_count > 5 ) { |
| 178 | + $results['abuse_count'] = $record->af_abuse_count; |
| 179 | + if( $record->af_abuse_count >= $wgArticleFeedbackv5AbusiveThreshold ) { |
| 180 | + // Return a flag in the JSON, that turns the link red. |
| 181 | + $results['abusive'] = 1; |
| 182 | + } |
| 183 | + if( $record->af_abuse_count >= $wgArticleFeedbackv5HideAbuseThreshold ) { |
177 | 184 | $dbw->update( |
178 | 185 | 'aft_article_feedback', |
179 | 186 | array( 'af_hide_count = af_hide_count + 1' ), |
180 | 187 | array( 'af_id' => $params['feedbackid'] ), |
181 | 188 | __METHOD__ |
182 | 189 | ); |
| 190 | + // Return a flag in the JSON, that knows to kill the row |
| 191 | + $results['abuse-hidden'] = 1; |
183 | 192 | } |
184 | | - global $wgArticleFeedbackv5AbusiveThreshold; |
185 | | - $results['abuse_count'] = $record->af_abuse_count; |
186 | | - if( $record->af_abuse_count > $wgArticleFeedbackv5AbusiveThreshold ) { |
187 | | - // Return a flag in the JSON, that turns the link red. |
188 | | - $results['abusive'] = 1; |
189 | | - } |
190 | 193 | } |
191 | 194 | |
192 | 195 | if ( $error ) { |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -365,7 +365,7 @@ |
366 | 366 | if ( $can_flag ) { |
367 | 367 | $aclass = 'articleFeedbackv5-abuse-link'; |
368 | 368 | global $wgArticleFeedbackv5AbusiveThreshold; |
369 | | - if ( $record[0]->af_abuse_count > $wgArticleFeedbackv5AbusiveThreshold ) { |
| 369 | + if ( $record[0]->af_abuse_count >= $wgArticleFeedbackv5AbusiveThreshold ) { |
370 | 370 | $aclass .= ' abusive'; |
371 | 371 | } |
372 | 372 | $footer_links .= Html::element( 'a', array( |
Index: trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php |
— | — | @@ -33,20 +33,20 @@ |
34 | 34 | global $wgUser; |
35 | 35 | parent::__construct( 'ArticleFeedbackv5' ); |
36 | 36 | |
37 | | - // NOTE: The 'all' option actually displays different things |
| 37 | + // NOTE: The 'all' option actually displays different things |
38 | 38 | // based on the users role, which is handled in the filter: |
39 | 39 | // - deleter-all is actually everything |
40 | | - // - hidder-all is 'visible + hidden' |
| 40 | + // - hidder-all is 'visible + hidden' |
41 | 41 | // - regular non-admin all is just 'all visible' |
42 | 42 | |
43 | | - if( $wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
| 43 | + if ( $wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
44 | 44 | array_push( $this->filters, |
45 | 45 | 'unhelpful', 'abusive', 'invisible' |
46 | 46 | ); |
47 | 47 | # removing the 'needsoversight' filter, per Fabrice |
48 | 48 | } |
49 | 49 | |
50 | | - if( $wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
| 50 | + if ( $wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
51 | 51 | $this->filters[] = 'deleted'; |
52 | 52 | } |
53 | 53 | } |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | $title = Title::newFromText( $param ); |
64 | 64 | |
65 | 65 | // Page does not exist. |
66 | | - if( !$title->exists() ) { |
| 66 | + if ( !$title->exists() ) { |
67 | 67 | $out->addWikiMsg( 'articlefeedbackv5-invalid-page-id' ); |
68 | 68 | return; |
69 | 69 | } |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | ); |
83 | 83 | |
84 | 84 | // Page exists, but feedback is disabled. |
85 | | - if( $dbr->numRows( $t ) == 0 ) { |
| 85 | + if ( $dbr->numRows( $t ) == 0 ) { |
86 | 86 | $out->addWikiMsg( 'articlefeedbackv5-page-disabled' ); |
87 | 87 | return; |
88 | 88 | } |
— | — | @@ -138,7 +138,7 @@ |
139 | 139 | |
140 | 140 | if ( $found ) { |
141 | 141 | $class = $found > 50 ? 'positive' : 'negative'; |
142 | | - $span = Html::rawElement( 'span', array( |
| 142 | + $span = Html::rawElement( 'span', array( |
143 | 143 | 'class' => "stat-marker $class" |
144 | 144 | ), wfMsg( 'percent', $found ) ); |
145 | 145 | $out->addHtml( |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | 'id' => 'articleFeedbackv5-special-add-feedback', |
161 | 161 | ), |
162 | 162 | $this->msg( 'articlefeedbackv5-special-add-feedback' )->text() |
163 | | - ) |
| 163 | + ) |
164 | 164 | . Html::element( 'div', array( 'class' => 'float-clear' ) ) |
165 | 165 | . Html::closeElement( 'div' ) |
166 | 166 | ); |
— | — | @@ -191,7 +191,7 @@ |
192 | 192 | |
193 | 193 | $opts = array(); |
194 | 194 | $counts = $this->getFilterCounts( $pageId ); |
195 | | - foreach( $this->filters as $filter ) { |
| 195 | + foreach ( $this->filters as $filter ) { |
196 | 196 | $count = array_key_exists( $filter, $counts ) ? $counts[$filter] : 0; |
197 | 197 | $key = $this->msg( 'articlefeedbackv5-special-filter-'.$filter, $count )->escaped(); |
198 | 198 | $opts[ (string) $key ] = $filter; |
— | — | @@ -322,7 +322,7 @@ |
323 | 323 | __METHOD__ |
324 | 324 | ); |
325 | 325 | |
326 | | - foreach( $rows as $row ) { |
| 326 | + foreach ( $rows as $row ) { |
327 | 327 | $rv[ $row->afc_filter_name ] = $row->afc_filter_count; |
328 | 328 | } |
329 | 329 | |