Index: trunk/extensions/ArticleFeedbackv5/sql/ArticleFeedbackv5.sql |
— | — | @@ -41,8 +41,9 @@ |
42 | 42 | af_unhelpful_count integer unsigned NOT NULL DEFAULT 0, |
43 | 43 | -- Net helpfulness (helpful - unhelpful). Used in fetch query. |
44 | 44 | af_net_helpfulness integer NOT NULL DEFAULT 0, |
45 | | - -- Flag a message as requiring oversight, being hidden ,or being deleted |
46 | | - af_needs_oversight boolean NOT NULL DEFAULT FALSE, |
| 45 | + -- Keep track of requests for oversight on the item |
| 46 | + af_oversight_count integer unsigned NOT NULL DEFAULT 0, |
| 47 | + -- Flag a message as being hidden or being deleted |
47 | 48 | af_is_deleted boolean NOT NULL DEFAULT FALSE, |
48 | 49 | af_is_hidden boolean NOT NULL DEFAULT FALSE, |
49 | 50 | -- Keep track of number of activities (hide/show/flag/unflag) |
Index: trunk/extensions/ArticleFeedbackv5/sql/alter.sql |
— | — | @@ -128,3 +128,4 @@ |
129 | 129 | |
130 | 130 | -- Added 2/14 (emsmith) |
131 | 131 | ALTER TABLE /*_*/aft_article_feedback ADD COLUMN af_activity_count integer unsigned NOT NULL DEFAULT 0; |
| 132 | +ALTER TABLE /*_*/aft_article_feedback CHANGE COLUMN af_needs_oversight af_oversight_count integer unsigned NOT NULL DEFAULT 0; |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -362,7 +362,7 @@ |
363 | 363 | $.articleFeedbackv5special.flagFeedback( id, 'delete', -1, note ); |
364 | 364 | break; |
365 | 365 | case 'declineoversight': |
366 | | - $.articleFeedbackv5special.flagFeedback( id, 'resetdelete', 1, note ); |
| 366 | + $.articleFeedbackv5special.flagFeedback( id, 'resetoversight', 1, note ); |
367 | 367 | break; |
368 | 368 | case 'requestoversight': |
369 | 369 | $.articleFeedbackv5special.flagFeedback( id, 'oversight', 1, note ); |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php |
— | — | @@ -29,8 +29,8 @@ |
30 | 30 | $notes = $params['note']; |
31 | 31 | $direction = isset( $params['direction'] ) ? $params['direction'] : 'increase'; |
32 | 32 | $counts = array( 'increment' => array(), 'decrement' => array() ); |
33 | | - $counters = array( 'abuse', 'helpful', 'unhelpful' ); |
34 | | - $flags = array( 'oversight', 'hide', 'delete' ); |
| 33 | + $counters = array( 'abuse', 'helpful', 'unhelpful', 'oversight' ); |
| 34 | + $flags = array( 'hide', 'delete' ); |
35 | 35 | $results = array(); |
36 | 36 | $helpful = null; |
37 | 37 | $error = null; |
— | — | @@ -44,16 +44,12 @@ |
45 | 45 | $error = 'articlefeedbackv5-invalid-feedback-id'; |
46 | 46 | } elseif ( in_array( $flag, $flags ) ) { |
47 | 47 | |
48 | | - $count = null; |
| 48 | + $count = null; |
49 | 49 | switch( $flag ) { |
50 | | - case 'hide': |
| 50 | + case 'hide': |
51 | 51 | $field = 'af_is_hidden'; |
52 | 52 | $count = 'invisible'; |
53 | 53 | break; |
54 | | - case 'oversight': |
55 | | - $field = 'af_needs_oversight'; |
56 | | - $count = 'needsoversight'; |
57 | | - break; |
58 | 54 | case 'delete': |
59 | 55 | $field = 'af_is_deleted'; |
60 | 56 | $count = 'deleted'; |
— | — | @@ -65,6 +61,7 @@ |
66 | 62 | } else { |
67 | 63 | $update[] = "$field = FALSE"; |
68 | 64 | } |
| 65 | + |
69 | 66 | // Increment or decrement whichever flag is being set. |
70 | 67 | $countDirection = $direction == 'increase' ? 'increment' : 'decrement'; |
71 | 68 | $counts[$countDirection][] = $count; |
— | — | @@ -78,6 +75,10 @@ |
79 | 76 | && $direction == 'decrease' ) { |
80 | 77 | $counts['increment'][] = 'visible'; |
81 | 78 | } |
| 79 | + } elseif( 'resetoversight' === $flag) { |
| 80 | + // special case, oversight request count becomes 0 |
| 81 | + $update[] = "af_oversight_count = 0"; |
| 82 | + |
82 | 83 | } elseif ( in_array( $flag, $counters ) ) { |
83 | 84 | // Probably this doesn't need validation, since the API |
84 | 85 | // will handle it, but if it's getting interpolated into |
— | — | @@ -302,7 +303,7 @@ |
303 | 304 | ApiBase::PARAM_REQUIRED => true, |
304 | 305 | ApiBase::PARAM_ISMULTI => false, |
305 | 306 | ApiBase::PARAM_TYPE => array( |
306 | | - 'abuse', 'hide', 'helpful', 'unhelpful', 'delete', 'undelete', 'unhide', 'oversight', 'unoversight' ) |
| 307 | + 'abuse', 'hide', 'helpful', 'unhelpful', 'delete', 'undelete', 'unhide', 'oversight', 'unoversight', 'resetoversight' ) |
307 | 308 | ), |
308 | 309 | 'direction' => array( |
309 | 310 | ApiBase::PARAM_REQUIRED => false, |
— | — | @@ -403,8 +404,13 @@ |
404 | 405 | return 'unrequest'; |
405 | 406 | } |
406 | 407 | |
407 | | - // TODO: how is "decline oversight" handled? |
408 | | - // how should fall out the bottom here be handled? a simple "feedback altered"? |
| 408 | + // handle resetoversight |
| 409 | + if ( 'resetoversight' == $flag) { |
| 410 | + return 'decline'; |
| 411 | + } |
| 412 | + |
| 413 | + // this is the default - we should never, ever get here, but just in case |
| 414 | + return 'flag'; |
409 | 415 | } |
410 | 416 | |
411 | 417 | /** |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -211,7 +211,7 @@ |
212 | 212 | 'afi_data_type', 'af_created', 'user_name', |
213 | 213 | 'af_user_ip', 'af_is_hidden', 'af_abuse_count', |
214 | 214 | 'af_helpful_count', 'af_unhelpful_count', |
215 | | - 'af_is_deleted', 'af_needs_oversight', 'af_revision_id', |
| 215 | + 'af_is_deleted', 'af_oversight_count', 'af_revision_id', |
216 | 216 | 'af_net_helpfulness', 'af_revision_id', |
217 | 217 | 'page_latest', 'page_title', 'page_namespace', |
218 | 218 | 'rating.aa_response_boolean AS rating' |
— | — | @@ -275,7 +275,7 @@ |
276 | 276 | |
277 | 277 | switch ( $filter ) { |
278 | 278 | case 'needsoversight': |
279 | | - $where[] = 'af_needs_oversight IS TRUE'; |
| 279 | + $where[] = 'af_oversight_count > 0'; |
280 | 280 | break; |
281 | 281 | case 'id': |
282 | 282 | # Used for permalinks. |
— | — | @@ -416,7 +416,7 @@ |
417 | 417 | |
418 | 418 | // !can delete == request oversight |
419 | 419 | if ( $can_hide && !$can_delete) { |
420 | | - if ( $record[0]->af_needs_oversight ) { |
| 420 | + if ( $record[0]->af_oversight_count > 0 ) { |
421 | 421 | $msg = 'unoversight'; |
422 | 422 | $class = 'unrequestoversight'; |
423 | 423 | } else { |
— | — | @@ -434,7 +434,7 @@ |
435 | 435 | if ( $can_delete ) { |
436 | 436 | |
437 | 437 | // if we have oversight requested, add "decline oversight" link |
438 | | - if ( $record[0]->af_needs_oversight ) { |
| 438 | + if ( $record[0]->af_oversight_count > 0 ) { |
439 | 439 | $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array( |
440 | 440 | 'id' => "articleFeedbackv5-declineoversight-link-$id", |
441 | 441 | 'class' => "articleFeedbackv5-declineoversight-link", |