Expand all

mw.Feedback

Obtain feedback from users. Functionality is provided by the mediawiki.feedback ResourceLoader module.

This is a way of getting simple feedback from users. It's useful for testing new features — users can give you feedback without the difficulty of opening a whole new talk page. For this reason, it also tends to collect a wider range of both positive and negative comments. However you do need to tend to the feedback page. It will get long relatively quickly, and you often get multiple messages reporting the same issue.

It takes the form of an element on your page which, when clicked, opens a small dialog box. Submitting that dialog box appends its contents to a wiki page that you specify, as a new section.

This feature works with any content model that defines a mw.messagePoster.MessagePoster.

// Minimal usage example
mw.loader.using( 'mediawiki.feedback').then(() => {
    var feedback = new mw.Feedback();
    $( '#myButton' ).click( function () { feedback.launch(); } );
});

You can also launch the feedback form with a prefilled subject and body. See the docs for the launch() method.

Classes

Dialog
Feedback dialog for use within the context mw.Feedback.

Constructor

new mw.Feedback([config]) #

Create an instance of mw.Feedback.

Parameters:

Name Type Attributes Description
config Object optional

Configuration object

Properties:
Name Type Attributes Default Description
title mw.Title optional
"Feedback"

The title of the page where you collect feedback.

apiUrl string optional

api.php URL if the feedback page is on another wiki

dialogTitleMessageKey string optional
"feedback-dialog-title"

Message key for the title of the dialog box

bugsLink mw.Uri | string optional
"//phabricator.wikimedia.org/maniphest/task/edit/form/1/"

URL where bugs can be posted

showUseragentCheckbox boolean optional
false

Show a Useragent agreement checkbox as part of the form.

useragentCheckboxMandatory boolean optional
false

Make the Useragent checkbox mandatory.

useragentCheckboxMessage string | jQuery optional

Supply a custom message for the useragent checkbox. Defaults to the mw.Message 'feedback-terms'.

Source:

Methods

launch([contents]) #

Modify the display form, and then open it, focusing interface on the subject.

Parameters:

Name Type Attributes Description
contents Object optional

Prefilled contents for the feedback form.

Properties:
Name Type Attributes Description
subject string optional

The subject of the feedback, as plaintext

message string optional

The content of the feedback, as wikitext

Source:
Modify the display form, and then open it, focusing interface on the subject.

onDialogSubmit(status, feedbackPageName, feedbackPageUrl) #

Respond to dialog submit event. If the information was submitted successfully, open a MessageDialog to thank the user.

Parameters:

Name Type Description
status string

A status of the end of operation of the main feedback dialog. Empty if the dialog was dismissed with no action or the user followed the button to the external task reporting site.

feedbackPageName string
feedbackPageUrl string
Source:
Respond to dialog submit event.