Content deleted Content added
(bot/CD) |
(bot/CD) |
||
Line 346:
var version = "0.4.2";
var gitAbbrevHash = "
var gitBranch = "main";
var gitDate = "
var gitVersion = "0.4.2+
/**
Line 3,823:
throw e;
}
}
/**
* Automatically applies a change tag to edits made by the user if
* a change tag was provided in the configuration.
* @param config
* @return A spreadable Object containing the `tags` parameter for `action=edit`.
*/
function changeTag(config) {
return config.core.changeTag.get() ?
{ tags: config.core.changeTag.get() } :
}
Line 4,148 ⟶ 4,161:
throw new Error(mw.msg('deputy.session.section.sectionIncomplete'));
}
return MwApi.action.postWithEditToken(Object.assign(Object.assign({}, changeTag(yield window.deputy.getWikiConfig())), { action: 'edit', pageid: this.casePage.pageId, section: sectionId, text: this.wikitext, baserevid: this.revid, summary: decorateEditSummary(this.editSummary) })).then(function (data) {
action: 'edit',▼
section: sectionId,▼
text: this.wikitext,▼
return data;
}, (code, data) => {
Line 6,157 ⟶ 6,163:
rvprop: 'timestamp'
}).then((data) => {
this.dateInputWidget.setValue(
// ISO-format date data.query.pages[0].revisions[0].timestamp.split('T')[0]); this.dateInputWidget.setDisabled(false);
this.setIcon('download');
Line 6,538 ⟶ 6,546:
else if (input instanceof mw.widgets.DateInputWidget) {
this.copiedTemplateRow[field] = value ?
if (value.length > 0) {
this.fieldLayouts[field].setWarnings([]);
Line 7,672 ⟶ 7,680:
if (input instanceof mw.widgets.DateInputWidget) {
this.splitArticleTemplateRow[field] = value ?
if (value.length > 0) {
fieldLayouts[field].setWarnings([]);
Line 8,184 ⟶ 8,192:
else if (input instanceof mw.widgets.DateInputWidget) {
this.mergedFromTemplate[field] = value ?
if (value.length > 0) {
fieldLayouts[field].setWarnings([]);
Line 8,419 ⟶ 8,427:
else if (input instanceof mw.widgets.DateInputWidget) {
this.mergedToTemplate[field] = value ?
if (value.length > 0) {
fieldLayouts[field].setWarnings([]);
Line 11,194 ⟶ 11,202:
invisibleLabel: true,
label: mw.msg('deputy.ante.mergeAll'),
title: mw.msg('deputy.ante.mergeAll')
});
this.mergeButton.on('click', () => {
Line 11,266 ⟶ 11,274:
}));
this.layout.on('remove', () => {
this.mergeButton.setDisabled(!Object.values(this.parsoid.findRowedNoticesByHref())
.some(v => v.length > 1)); deleteButton.setDisabled(this.parsoid.findNotices().length === 0);
});
this.parsoid.addEventListener('templateInsert', () => {
this.mergeButton.setDisabled(!Object.values(this.parsoid.findRowedNoticesByHref())
.some(v => v.length > 1)); deleteButton.setDisabled(this.parsoid.findNotices().length === 0);
});
Line 11,382 ⟶ 11,392:
// Saves the page.
process.next(() => __awaiter(this, void 0, void 0, function* () {
return new mw.Api().postWithEditToken(Object.assign(Object.assign({}, changeTag(yield window.CopiedTemplateEditor.getWikiConfig())), { action: 'edit', format: 'json', formatversion: '2', utf8: 'true', title: this.parsoid.getPage(), text: yield this.parsoid.toWikitext(), summary: decorateEditSummary(mw.msg(this.parsoid.originalCount > 0 ?
'deputy.ante.content.modify' :
'deputy.ante.content.add')) })).catch((e, c) => {
throw errorToOO(e, c);
});
Line 13,070 ⟶ 13,072:
displayOptions: { type: 'text' },
alwaysSave: true
})
};
Line 13,412 ⟶ 13,418:
// Update last edited number
this.core.lastEdited.set(Date.now());
yield MwApi.action.postWithEditToken(Object.assign(Object.assign({}, changeTag(yield window.deputy.getWikiConfig())), { action: 'edit', title: this.sourcePage.getPrefixedText(), text: this.serialize() }));
▲ });
});
}
Line 14,099 ⟶ 14,101:
// The `catch` statement here can theoretically create an infinite loop given
// enough race conditions. Don't worry about it too much, though.
yield MwApi.action.postWithEditToken(Object.assign(Object.assign(Object.assign(Object.assign({}, changeTag(yield window.InfringementAssistant.getWikiConfig())), { action: 'edit', title: listingPage.getPrefixedText() }), textParameters), { summary })).then(() => {
// Purge the main listing page.
return MwApi.action.post({
Line 14,302 ⟶ 14,304:
*/
static get articleCvRegex() {
// Acceptable level of danger; global configuration is found only in trusted
// places (see WikiConfiguration documentation).
// eslint-disable-next-line security/detect-non-literal-regexp
return new RegExp(window.InfringementAssistant.wikiConfig.ia.listingWikitextMatch.get());
}
Line 14,558 ⟶ 14,563:
return __awaiter(this, void 0, void 0, function* () {
const newWikitext = yield this.addComment(message, indent);
yield MwApi.action.postWithEditToken(Object.assign(Object.assign({}, changeTag(yield window.InfringementAssistant.getWikiConfig())), { action: 'edit', format: 'json', formatversion: '2', utf8: 'true', title: this.listingPage.title.getPrefixedText(), text: newWikitext, summary: decorateEditSummary(summary !== null && summary !== void 0 ? summary : mw.msg('deputy.ia.content.respond', this.listingPage.title.getPrefixedText(), this.title.getPrefixedText())) }));▼
▲ summary: decorateEditSummary(summary !== null && summary !== void 0 ? summary : mw.msg('deputy.ia.content.respond', this.listingPage.title.getPrefixedText(), this.title.getPrefixedText()))
yield this.listingPage.getWikitext(true);
});
Line 15,254 ⟶ 15,251:
this.wikitext.slice(this.data.endOffset);
}
yield MwApi.action.postWithEditToken(Object.assign(Object.assign({}, changeTag(yield window.InfringementAssistant.getWikiConfig())), { action: 'edit', title: this.page.getPrefixedText(), text: finalPageContent, summary: decorateEditSummary(this.data.entirePage ?
mw.msg(this.data.presumptive ?
'deputy.ia.content.hideAll.pd' :
Line 15,274 ⟶ 15,267:
.cci.rootPage.get().getPrefixedText(),
this.data.presumptiveCase
] : []))) }));
▲ });
});
}
Line 16,316 ⟶ 16,308:
/**
* This version of Deputy.
▲ *
*/
this.version = version;
Line 16,364 ⟶ 16,354:
init() {
return __awaiter(this, void 0, void 0, function* () {
// Attach modules to respective names
window.CopiedTemplateEditor = this.ante;
window.InfringementAssistant = this.ia;
mw.hook('deputy.preload').fire(this);
// Initialize the configuration
this.config =
window.deputyLang = this.config.core.language.get();
// Inject CSS
|