"Bsitu" posted a comment on MediaWiki.r109565.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/109565#c29793

Commit summary for MediaWiki.r109565:

AFT5 feedback page - allow sorting by helpfulness, and add unhelpful flag, per 
mockups. Streamline some of the JS, and improve a couple of translation lines.

Bsitu's comment:

<code>
if ( !isset( $params['feedbackid'] )
                 || !preg_match( '/^\d+$/', $params['feedbackid'] ) ) {
                        $error = 'articlefeedbackv5-invalid-feedback-id';
}
</code>

the code validation is not necessary because feedbackid is defined as required 
and integer in the API, the base class will handle the data validation/type 
casting

<code>
elseif ( $params['flagtype'] == 'unhelpful' ) {
        $update['af_unhelpful_count'] = $record->af_unhelpful_count + 1;
}
</code>

If there are multiple concurrent flag API requests at the same time, 
af_unhelpful_count will not be updated correctly, you probably should use:
$update[] = 'af_unhelpful_count = af_unhelpful_count + 1';

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to