r108250 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108249‎ | r108250 | r108251 >
Date:16:23, 6 January 2012
Author:rsterbin
Status:resolved (Comments)
Tags:
Comment:
Fixed the error messaging logic: a string in the api field is a message; an object means it has more data
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -1027,7 +1027,7 @@
10281028 getFormData: function () {
10291029 var data = {};
10301030 var rating = $.articleFeedbackv5.find( '.articleFeedbackv5-rating input:hidden' ).val();
1031 - if ( '0' != rating ) {
 1031+ if ( true ) { // '0' != rating ) {
10321032 data.rating = rating;
10331033 }
10341034 data.comment = $.articleFeedbackv5.find( '.articleFeedbackv5-comment textarea' ).val();
@@ -2760,13 +2760,19 @@
27612761 * @param object errors errors, indexed by field name
27622762 */
27632763 $.articleFeedbackv5.markFormErrors = function ( errors ) {
 2764+ aft5_debug( 'got here' );
27642765 if ( '_api' in errors ) {
2765 - if ( $.articleFeedbackv5.debug ) {
2766 - $.articleFeedbackv5.markTopError( errors._api.info );
 2766+ if ( typeof errors._api == 'object' ) {
 2767+ if ( 'info' in errors._api ) {
 2768+ mw.log( mw.msg( errors._api.info ) );
 2769+ } else {
 2770+ mw.log( mw.msg( 'articlefeedbackv5-error-submit' ) );
 2771+ }
 2772+ $.articleFeedbackv5.markTopError( mw.msg( 'articlefeedbackv5-error-submit' ) );
27672773 } else {
2768 - mw.log( mw.msg( 'articlefeedbackv5-error-submit' ) );
 2774+ mw.log( mw.msg( errors._api ) );
 2775+ $.articleFeedbackv5.markTopError( errors._api );
27692776 }
2770 - mw.log( mw.msg( errors._api.info ) );
27712777 } else {
27722778 mw.log( mw.msg( 'articlefeedbackv5-error-validation' ) );
27732779 if ( 'nofeedback' in errors ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r108269Debug code needs removingrsterbin19:15, 6 January 2012
r1084701.18wmf1: MFT r108239, r108245, r108247, r108250, r108269, r108280catrope20:28, 9 January 2012

Comments

#Comment by Catrope (talk | contribs)   19:57, 9 January 2012

The

+				if ( 'info' in errors._api ) {

logic only applies to the mw.log call, not to the markTopError call, is that intended?

OK otherwise, marking OK.

#Comment by Rsterbin (talk | contribs)   20:01, 9 January 2012

That's correct. In event of a db error, errors._api.info would have detailed info on multiple lines -- so appropriate for a console dump, but not for the top of the form.

Status & tagging log