Simplify and fix siteSetting instantiation

pull/327/head
Kevin Payravi 2023-11-04 13:50:10 -05:00
parent 6cebd8618d
commit fe9a4a134b
2 changed files with 2 additions and 16 deletions

View File

@ -362,14 +362,7 @@ async function main(eventInfo) {
// Get user's settings for the wiki
let settings = storage.wikiSettings || {};
let id = site['id'];
let siteSetting = '';
if (settings.hasOwnProperty(id)) {
siteSetting = settings[id];
} else if (storage.defaultWikiAction) {
siteSetting = storage.defaultWikiAction;
} else {
siteSetting = 'alert';
}
let siteSetting = settings[id] || storage.defaultWikiAction || 'alert';
// Check if redirects are enabled for the site
if (siteSetting === 'redirect') {
// Get article name from the end of the URL;

View File

@ -252,14 +252,7 @@ function main() {
// Get user's settings for the wiki
let settings = storage.wikiSettings || {};
let id = site['id'];
let siteSetting = '';
if (settings.hasOwnProperty(id)) {
siteSetting = settings[id];
} else if (storage.defaultActionSettings && storage.defaultActionSettings[site.language]) {
siteSetting = storage.defaultActionSettings[site.language];
} else {
siteSetting = 'alert';
}
let siteSetting = settings[id] || storage.defaultWikiAction || 'alert';
// Notify if enabled for the wiki:
if (siteSetting === 'alert') {
// Get article name from the end of the URL;