Update warning about logged-out editing for temp user creation

Depends-On: I2ea656a8a1704a495f1a94fede1a8829ba7325a1
Depends-On: I84ce108b4d46b4e19fad032382f8b69a1b0065d5
Bug: T332432
Change-Id: I8487d7d249c66bf3c3c60120f490a6ba72745aac
This commit is contained in:
Bartosz Dziewoński 2023-04-28 00:44:33 +02:00
parent 060c38b7e0
commit 8b2e0d7be9
6 changed files with 23 additions and 4 deletions

View file

@ -193,6 +193,13 @@
"ModeTabOptionWidget.js",
"AbandonCommentDialog.js",
"AbandonTopicDialog.js",
{
"name": "contLangMessages.json",
"callback": "\\MediaWiki\\Extension\\DiscussionTools\\ResourceLoaderData::getContentLanguageMessages",
"callbackParam": [
"tempuser-helppage"
]
},
{
"name": "licenseMessages.json",
"callback": "\\MediaWiki\\Extension\\DiscussionTools\\ResourceLoaderData::getTermsOfUseMessagesParsed",
@ -211,6 +218,7 @@
"discussiontools-replywidget-abandontopic-keep",
"discussiontools-replywidget-advanced",
"discussiontools-replywidget-anon-warning",
"discussiontools-replywidget-autocreate-warning",
"discussiontools-replywidget-cancel",
"discussiontools-replywidget-feedback",
"discussiontools-replywidget-mention-tool-header",

View file

@ -117,6 +117,7 @@
"discussiontools-replywidget-abandontopic-keep": "Continue writing",
"discussiontools-replywidget-advanced": "Advanced",
"discussiontools-replywidget-anon-warning": "<strong>You are not logged in.</strong> To be notified when someone replies and receive attribution with your name instead of your IP address, you can [$1 log in] or [$2 create an account].",
"discussiontools-replywidget-autocreate-warning": "<strong>You are not logged in.</strong> To be notified when someone replies and receive attribution with a name of your choice instead of an [[$3|auto-generated name]], you can [$1 log in] or [$2 create an account].",
"discussiontools-replywidget-cancel": "Cancel",
"discussiontools-replywidget-feedback": "{{GENDER:|Share feedback}} about this feature",
"discussiontools-replywidget-feedback-link": "https://www.mediawiki.org/wiki/Talk:Talk_pages_project/Replying",

View file

@ -131,6 +131,7 @@
"discussiontools-replywidget-abandontopic-keep": "Label for button to cancel abandoning a new topic\n\nThis button follows {{msg-mw|discussiontools-replywidget-abandontopic}}.\n\nSimilar to {{msg-mw|discussiontools-replywidget-abandon-keep}}.",
"discussiontools-replywidget-advanced": "Label for button to toggle the advanced options, which shows an edit summary input and watchlist checkbox.",
"discussiontools-replywidget-anon-warning": "Warning message to be displayed when anonymous user starts writing a new topic or reply.\n* $1 is a URL to log in.\n* $2 is a URL to register an account.",
"discussiontools-replywidget-autocreate-warning": "Warning message to be displayed when anonymous user starts writing a new topic or reply, and temporary user auto-creation is enabled.\n* $1 is a URL to log in.\n* $2 is a URL to register an account.\n* $3 is a link to the documentation page for temporary accounts.",
"discussiontools-replywidget-cancel": "Label for the cancel button to exit out of the widget\n\n{{Identical|Cancel}}",
"discussiontools-replywidget-feedback": "Label for link to share feedback about the reply widget",
"discussiontools-replywidget-feedback-link": "{{optional|Link to a page where users can share feedback about the reply widget. Defaults to a page on MediaWiki.org.}}",

View file

@ -7,13 +7,16 @@
* @param {number} oldId Revision ID of page at time of editing
* @param {Object.<string,string>} notices Edit notices for the page where the reply is being saved.
* Keys are message names; values are HTML to display.
* @param {boolean} wouldAutoCreate Whether saving the comment would automatically create a
* temporary account if the user is logged out
* @param {string} preloadContent Preload content, may be wikitext or HTML depending on `preloadContentMode`
* @param {string} preloadContentMode 'source' or 'visual'
*/
function CommentDetails( pageName, oldId, notices, preloadContent, preloadContentMode ) {
function CommentDetails( pageName, oldId, notices, wouldAutoCreate, preloadContent, preloadContentMode ) {
this.pageName = pageName;
this.oldId = oldId;
this.notices = notices;
this.wouldAutoCreate = wouldAutoCreate;
this.preloadContent = preloadContent;
this.preloadContentMode = preloadContentMode;
}

View file

@ -214,7 +214,7 @@ function checkThreadItemOnPage( pageName, oldId, threadItem ) {
} ] } ).promise();
}
return new CommentDetails( pageName, oldId, metadata.notices, metadata.content, defaultMode );
return new CommentDetails( pageName, oldId, metadata.notices, metadata.wouldautocreate, metadata.content, defaultMode );
} );
}

View file

@ -2,6 +2,7 @@ var controller = require( 'ext.discussionTools.init' ).controller,
utils = require( 'ext.discussionTools.init' ).utils,
ModeTabSelectWidget = require( './ModeTabSelectWidget.js' ),
ModeTabOptionWidget = require( './ModeTabOptionWidget.js' ),
contLangMessages = require( './contLangMessages.json' ),
licenseMessages = require( './licenseMessages.json' ),
featuresEnabled = mw.config.get( 'wgDiscussionToolsFeaturesEnabled' ) || {},
enable2017Wikitext = featuresEnabled.sourcemodetoolbar,
@ -267,6 +268,9 @@ function ReplyWidget( commentController, commentDetails, config ) {
}
if ( mw.user.isAnon() ) {
var msg = this.commentDetails.wouldAutoCreate ?
'discussiontools-replywidget-autocreate-warning' :
'discussiontools-replywidget-anon-warning';
var returnTo = {
returntoquery: window.location.search.slice( 1 ),
returnto: mw.config.get( 'wgPageName' )
@ -274,10 +278,12 @@ function ReplyWidget( commentController, commentDetails, config ) {
this.anonWarning = new OO.ui.MessageWidget( {
classes: [ 'ext-discussiontools-ui-replyWidget-anonWarning' ],
type: 'warning',
label: mw.message( 'discussiontools-replywidget-anon-warning' )
// eslint-disable-next-line mediawiki/msg-doc
label: mw.message( msg )
.params( [
mw.util.getUrl( 'Special:Userlogin', returnTo ),
mw.util.getUrl( 'Special:Userlogin/signup', returnTo )
mw.util.getUrl( 'Special:Userlogin/signup', returnTo ),
contLangMessages[ 'tempuser-helppage' ]
] )
.parseDom()
} );