MediaWiki:Gadget-friendlytalkback.js: Difference between revisions

m
1 revision imported
m (1 revision imported)
 
m (1 revision imported)
(One intermediate revision by the same user not shown)
Line 85: Line 85:


// Check whether the user has opted out from talkback
// Check whether the user has opted out from talkback
// TODO: wgCategories is only set on action=view (bug 45033)
var query = {
var wgcat = mw.config.get("wgCategories");
action: 'query',
if (wgcat.length && wgcat.indexOf("Users who do not wish to receive talkbacks") === -1) {
prop: 'extlinks',
Twinkle.talkback.optout = false;
titles: mw.config.get('wgPageName'),
} else {
elquery: 'userjs.invalid/noTalkback',
var query = {
ellimit: '1'
action: 'query',
};
prop: 'extlinks',
var wpapi = new Morebits.wiki.api("Fetching talkback opt-out status", query, Twinkle.talkback.callback.optoutStatus);
titles: mw.config.get('wgPageName'),
wpapi.post();
elquery: 'userjs.invalid/noTalkback',
ellimit: '1'
};
var wpapi = new Morebits.wiki.api("Fetching talkback opt-out status", query, Twinkle.talkback.callback.optoutStatus);
wpapi.post();
}
};
};


Line 369: Line 363:
switch (page) {
switch (page) {
case "afchd":
case "afchd":
text += "\n\n{{subst:AFCHD/u|" + section + "}} ~~~~";
text = "\n\n{{subst:AFCHD/u|" + section + "}} ~~~~";
talkpage.setEditSummary( "You have replies at the [[Wikipedia:AFCHD|Articles for Creation Help Desk]]" + Twinkle.getPref("summaryAd") );
talkpage.setEditSummary( "You have replies at the [[Wikipedia:AFCHD|Articles for Creation Help Desk]]" + Twinkle.getPref("summaryAd") );
break;
break;
Line 429: Line 423:
}
}
text += "|more=" + message.trim() + "}}";
text += "|more=" + message.trim() + "}}";
talkpage.setEditSummary("Please check the discussion at [[" + tbPageName +
talkpage.setEditSummary("Please check the discussion at [[:" + tbPageName +
(section ? ("#" + section) : "") + "]]" + Twinkle.getPref("summaryAd"));
(section ? ("#" + section) : "") + "]]" + Twinkle.getPref("summaryAd"));


Line 449: Line 443:
}
}


var editSummary = "Talkback ([[";
var editSummary = "Talkback ([[:";
if (tbtarget !== "other" && !/^\s*user talk:/i.test(tbPageName)) {
if (tbtarget !== "other" && !/^\s*user talk:/i.test(tbPageName)) {
editSummary += "User talk:";
editSummary += "User talk:";
14,061

edits