Skip to content

Commit

Permalink
Apply minor improvements
Browse files Browse the repository at this point in the history
Change-Id: I9434c24b627b2c8bf09dc2b4b38023ef16e226a5
  • Loading branch information
jwbth committed May 26, 2024
1 parent ec7d51f commit 5e60443
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Quoting comments with formatting preserved
* Autofilling the edit summary with indication of the addressee of the comment
* Saving comment drafts to restore the forms' content after unexpected events such as browser crashes
* Uploading images to Wikimedia Commons in three clicks
* Uploading screenshots to Wikimedia Commons in three clicks
* Creating topics and subsections
* Redesigned talk pages, with author and date displayed on top of comments (opt-in) and thin lines denoting threads
* Handling "outdent" templates
Expand Down
2 changes: 1 addition & 1 deletion config/w-ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export default {
noSignatureClasses: [
'ambox',
'NavHead',
'raaf',
'raaf', // [[Википедия:Запросы к администраторам/Быстрые]]
],

noSignatureTemplates: [
Expand Down
18 changes: 9 additions & 9 deletions src/SettingsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,28 +235,28 @@ class SettingsDialog extends ProcessDialog {
value: name,
selected: settingValues[name],
}, data));
controls[name].input.on('change', this.updateStates.bind(this));
controls[name].input.on('change', this.updateAbilities.bind(this));
break;

case 'radio':
controls[name] = createRadioField(Object.assign({
selected: settingValues[name],
}, data));
controls[name].select.on('select', this.updateStates.bind(this));
controls[name].select.on('select', this.updateAbilities.bind(this));
break;

case 'text':
controls[name] = createTextField(Object.assign({
value: settingValues[name],
}, data));
controls[name].input.on('change', this.updateStates.bind(this));
controls[name].input.on('change', this.updateAbilities.bind(this));
break;

case 'number':
controls[name] = createNumberField(Object.assign({
value: settingValues[name],
}, data));
controls[name].input.on('change', this.updateStates.bind(this));
controls[name].input.on('change', this.updateAbilities.bind(this));
break;

case 'multicheckbox':
Expand All @@ -271,7 +271,7 @@ class SettingsDialog extends ProcessDialog {
)),
classes: data.classes,
});
controls[name].multiselect.on('select', this.updateStates.bind(this));
controls[name].multiselect.on('select', this.updateAbilities.bind(this));
controls[name].field = new OO.ui.FieldLayout(controls[name].multiselect, {
label: data.label,
align: 'top',
Expand All @@ -287,7 +287,7 @@ class SettingsDialog extends ProcessDialog {
tagLimit: data.tagLimit,
selected: (data.dataToUi || ((val) => val)).call(null, settingValues[name]),
});
controls[name].multiselect.on('change', this.updateStates.bind(this));
controls[name].multiselect.on('change', this.updateAbilities.bind(this));
controls[name].field = new OO.ui.FieldLayout(controls[name].multiselect, {
label: data.label,
align: 'top',
Expand Down Expand Up @@ -326,7 +326,7 @@ class SettingsDialog extends ProcessDialog {
setupOutlineItem() {
this.outlineItem.setLabel(pageData.label);
}
}))(this);
}))();
});

controls.removeData.button.connect(this, { click: 'removeData' });
Expand Down Expand Up @@ -355,7 +355,7 @@ class SettingsDialog extends ProcessDialog {
this.bookletLayout.addPages(this.createPages(settingValues));
this.settingsPanel.$element.empty().append(this.bookletLayout.$element);

this.updateStates();
this.updateAbilities();
}

/**
Expand Down Expand Up @@ -431,7 +431,7 @@ class SettingsDialog extends ProcessDialog {
*
* @protected
*/
async updateStates() {
async updateAbilities() {
const controls = this.controls;

controls.collapseThreadsLevel.input.setDisabled(!controls.enableThreads.input.isSelected());
Expand Down
15 changes: 8 additions & 7 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,14 @@ export default {
* @returns {Element[]}
*/
getClosedDiscussions() {
if (!this.content.closedDiscussions) {
const closedDiscussionsSelector = cd.config.closedDiscussionClasses
.concat('mw-archivedtalk')
.map((name) => `.${name}`)
.join(', ');
this.content.closedDiscussions = this.$root.find(closedDiscussionsSelector).get();
}
this.content.closedDiscussions ||= this.$root
.find(
cd.config.closedDiscussionClasses
.concat('mw-archivedtalk')
.map((name) => `.${name}`)
.join(', ')
)
.get();

return this.content.closedDiscussions;
},
Expand Down

0 comments on commit 5e60443

Please sign in to comment.