mw.feedback: Remove a hack with passing message parameters
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 17 Oct 2018 20:33:54 +0000 (22:33 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 17 Oct 2018 20:34:58 +0000 (22:34 +0200)
I'm not sure what bug this is trying to work around. It mentions
T49395 but that doesn't look very relevant. Maybe the real problem was
confusion and bugs related to passing "raw params" (T33260#4675605).
Regardless, it's no longer needed now, because this code also works.

Change-Id: I580d46a5e4b7ff58989cb5fd6b7770e781fb5319

resources/src/mediawiki.feedback/feedback.js

index d1fb98b..5b73e7c 100644 (file)
                                }
                        }, this )
                        .next( function () {
-                               var plainMsg, parsedMsg,
+                               var $link,
                                        settings = data.settings;
                                data.contents = data.contents || {};
 
                                this.useragentMandatory = settings.useragentCheckbox.mandatory;
                                this.useragentFieldLayout.toggle( settings.useragentCheckbox.show );
 
-                               // HACK: Setting a link in the messages doesn't work. There is already a report
-                               // about this, and the bug report offers a somewhat hacky work around that
-                               // includes setting a separate message to be parsed.
-                               // We want to make sure the user can configure both the title of the page and
-                               // a separate url, so this must be allowed to parse correctly.
-                               // See https://phabricator.wikimedia.org/T49395#490610
-                               mw.messages.set( {
-                                       'feedback-dialog-temporary-message':
-                                               '<a href="' + this.feedbackPageUrl + '" target="_blank">' + this.feedbackPageName + '</a>'
-                               } );
-                               plainMsg = mw.message( 'feedback-dialog-temporary-message' ).plain();
-                               mw.messages.set( { 'feedback-dialog-temporary-message-parsed': plainMsg } );
-                               parsedMsg = mw.message( 'feedback-dialog-temporary-message-parsed' );
+                               $link = $( '<a>' )
+                                       .attr( 'href', this.feedbackPageUrl )
+                                       .attr( 'target', '_blank' )
+                                       .text( this.feedbackPageName );
                                this.feedbackMessageLabel.setLabel(
-                                       // Double-parse
-                                       $( '<span>' )
-                                               .append( mw.message( 'feedback-dialog-intro', parsedMsg ).parse() )
+                                       mw.message( 'feedback-dialog-intro', $link ).parseDom()
                                );
 
                                this.validateFeedbackForm();