Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -204,7 +204,9 @@ |
205 | 205 | var $l = $( e.target ); |
206 | 206 | var id = $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
207 | 207 | var activity = $.articleFeedbackv5special.getActivity( id ); |
208 | | - if ( activity.hide ) { |
| 208 | + if ( activity.hide |
| 209 | + || $( e.target ).text() == mw.msg('articlefeedbackv5-form-unhide') |
| 210 | + ) { |
209 | 211 | $.articleFeedbackv5special.flagFeedback( id, 'hide', -1 ); |
210 | 212 | } else { |
211 | 213 | $.articleFeedbackv5special.flagFeedback( id, 'hide', 1 ); |
— | — | @@ -217,7 +219,9 @@ |
218 | 220 | var $l = $( e.target ); |
219 | 221 | var id = $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
220 | 222 | var activity = $.articleFeedbackv5special.getActivity( id ); |
221 | | - if ( activity.delete ) { |
| 223 | + if ( activity.delete |
| 224 | + || $( e.target ).text() == mw.msg('articlefeedbackv5-form-undelete') |
| 225 | + ) { |
222 | 226 | $.articleFeedbackv5special.flagFeedback( id, 'delete', -1 ); |
223 | 227 | } else { |
224 | 228 | $.articleFeedbackv5special.flagFeedback( id, 'delete', 1 ); |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php |
— | — | @@ -50,12 +50,13 @@ |
51 | 51 | case 'oversight': |
52 | 52 | $field = 'af_needs_oversight'; |
53 | 53 | $count = 'needsoversight'; |
| 54 | + break; |
54 | 55 | case 'delete': |
55 | 56 | $field = 'af_is_deleted'; |
56 | 57 | $count = 'deleted'; |
| 58 | + break; |
57 | 59 | default: return; # return error, ideally. |
58 | 60 | } |
59 | | - |
60 | 61 | if( $direction == 'increase' ) { |
61 | 62 | $update[] = "$field = TRUE"; |
62 | 63 | } else { |
— | — | @@ -63,12 +64,18 @@ |
64 | 65 | } |
65 | 66 | |
66 | 67 | // Increment or decrement whichever flag is being set. |
67 | | - $counts[$direction][] = $count; |
| 68 | + $countDirection = $direction == 'increase' ? 'increment' : 'decrement'; |
| 69 | + $counts[$countDirection][] = $count; |
68 | 70 | // If this is hiding/deleting, decrement the visible count. |
69 | 71 | if( ( $count == 'hide' || $count == 'deleted' ) |
70 | 72 | && $direction == 'increase' ) { |
71 | | - $counts['decrease'][] = 'visible'; |
| 73 | + $counts['decrement'][] = 'visible'; |
72 | 74 | } |
| 75 | + // If this is unhiding/undeleting, increment the visible count. |
| 76 | + if( ( $count == 'hide' || $count == 'deleted' ) |
| 77 | + && $direction == 'decrease' ) { |
| 78 | + $counts['increment'][] = 'visible'; |
| 79 | + } |
73 | 80 | } elseif ( in_array( $flag, $counters ) ) { |
74 | 81 | // Probably this doesn't need validation, since the API |
75 | 82 | // will handle it, but if it's getting interpolated into |