build: Bump grunt-contrib-jshint from 0.11.3 to 0.12.0
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.feedback.js
index 68818be..8a3784c 100644 (file)
@@ -6,7 +6,7 @@
  * @author Moriel Schottlender, 2015
  * @since 1.19
  */
-/*jshint es3:false */
+/*jshint esversion:5 */
 /*global OO*/
 ( function ( mw, $ ) {
        /**
@@ -38,6 +38,7 @@
         * @param {Object} [config] Configuration object
         * @cfg {mw.Title} [title="Feedback"] The title of the page where you collect
         *  feedback.
+        * @cfg {string} [apiUrl] api.php URL if the feedback page is on another wiki
         * @cfg {string} [dialogTitleMessageKey="feedback-dialog-title"] Message key for the
         *  title of the dialog box
         * @cfg {mw.Uri|string} [bugsLink="//phabricator.wikimedia.org/maniphest/task/create/"] URL where
@@ -57,7 +58,7 @@
                // Feedback page title
                this.feedbackPageTitle = config.title || new mw.Title( 'Feedback' );
 
-               this.messagePosterPromise = mw.messagePoster.factory.create( this.feedbackPageTitle );
+               this.messagePosterPromise = mw.messagePoster.factory.create( this.feedbackPageTitle, config.apiUrl );
 
                // Links
                this.bugsTaskSubmissionLink = config.bugsLink || '//phabricator.wikimedia.org/maniphest/task/create/';
                        case 'submitted':
                                dialogConfig = {
                                        title: mw.msg( 'feedback-thanks-title' ),
-                                       message: $( '<span>' ).append(
-                                               mw.message(
-                                                       'feedback-thanks',
-                                                       this.feedbackPageTitle.getNameText(),
-                                                       $( '<a>' )
-                                                               .attr( {
-                                                                       target: '_blank',
-                                                                       href: this.feedbackPageTitle.getUrl()
-                                                               } )
-                                               ).parse()
+                                       message: $( '<span>' ).msg(
+                                               'feedback-thanks',
+                                               this.feedbackPageTitle.getNameText(),
+                                               $( '<a>' ).attr( {
+                                                       target: '_blank',
+                                                       href: this.feedbackPageTitle.getUrl()
+                                               } )
                                        ),
                                        actions: [
                                                {
                        classes: [ 'mw-feedbackDialog-welcome-message' ]
                } );
                this.feedbackSubjectInput = new OO.ui.TextInputWidget( {
+                       indicator: 'required',
                        multiline: false
                } );
                this.feedbackMessageInput = new OO.ui.TextInputWidget( {
                                        !this.useragentMandatory ||
                                        this.useragentCheckbox.isSelected()
                                ) &&
-                               (
-                                       !!this.feedbackMessageInput.getValue() ||
-                                       !!this.feedbackSubjectInput.getValue()
-                               )
+                               this.feedbackSubjectInput.getValue()
                        );
 
                this.actions.setAbilities( { submit:  isValid } );