Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -246,14 +246,23 @@ |
247 | 247 | |
248 | 248 | // Don't let non-allowed users see these. |
249 | 249 | if ( !$wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
250 | | - $where['af_is_hidden'] = 0; |
| 250 | + $where[] = 'af_is_hidden IS FALSE'; |
251 | 251 | } |
252 | 252 | |
253 | 253 | // Don't let non-allowed users see these. |
254 | 254 | if ( !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
255 | | - $where['af_is_deleted'] = 0; |
| 255 | + $where[] = 'af_is_deleted IS FALSE'; |
256 | 256 | } |
257 | 257 | |
| 258 | + // Never show hidden or deleted posts unless specifically requested. |
| 259 | + if( $filter != 'invisible' && $filter != 'deleted' ) { |
| 260 | + $where[] = 'af_is_hidden IS FALSE'; |
| 261 | + } |
| 262 | + |
| 263 | + if( $filter != 'deleted' ) { |
| 264 | + $where[] = 'af_is_deleted IS FALSE'; |
| 265 | + } |
| 266 | + |
258 | 267 | switch ( $filter ) { |
259 | 268 | case 'needsoversight': |
260 | 269 | $where[] = 'af_needs_oversight IS TRUE'; |
— | — | @@ -263,30 +272,31 @@ |
264 | 273 | $where['af_id'] = $filterValue; |
265 | 274 | break; |
266 | 275 | case 'visible': |
267 | | - $where['af_is_deleted'] = 0; |
268 | | - $where['af_is_hidden'] = 0; |
| 276 | + $where[] = 'af_is_deleted IS FALSE'; |
| 277 | + $where[] = 'af_is_hidden IS FALSE'; |
269 | 278 | break; |
270 | 279 | case 'invisible': |
271 | | - $where[] = 'af_is_hidden > 0'; |
| 280 | + $where[] = 'af_is_hidden IS TRUE'; |
272 | 281 | break; |
273 | 282 | case 'abusive': |
274 | 283 | $where[] = 'af_abuse_count > 0'; |
275 | 284 | break; |
276 | 285 | case 'helpful': |
277 | | - $where[] = 'CONVERT(af_helpful_count, SIGNED) - CONVERT(af_unhelpful_count, SIGNED) > 0'; |
| 286 | + $where[] = 'af_net_helpfulness > 0'; |
278 | 287 | break; |
279 | 288 | case 'unhelpful': |
280 | | - $where[] = 'CONVERT(af_helpful_count, SIGNED) - CONVERT(af_unhelpful_count, SIGNED) < 0'; |
| 289 | + $where[] = 'af_net_helpfulness < 0'; |
281 | 290 | break; |
282 | 291 | case 'comment': |
283 | 292 | $where[] = 'comment.aa_response_text IS NOT NULL'; |
284 | 293 | break; |
285 | 294 | case 'deleted': |
286 | | - $where[] = 'af_is_deleted > 0'; |
| 295 | + $where[] = 'af_is_deleted IS TRUE'; |
287 | 296 | break; |
288 | 297 | default: |
289 | 298 | break; |
290 | 299 | } |
| 300 | + |
291 | 301 | return $where; |
292 | 302 | } |
293 | 303 | |