Skip to content

Commit

Permalink
Fix reset defaults for non-GMs
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Oct 27, 2023
1 parent 4c438d5 commit 2a833d8
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions src/module/forms/GeneralSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,28 +146,40 @@ export class PolyglotGeneralSettings extends FormApplication {
super.activateListeners(html);
html.find("button").on("click", async (event) => {
if (event.currentTarget?.dataset?.action === "reset") {
const keys = [
"RuneRegex",
"enableAllFonts",
"exportFonts",
"IgnoreJournalFontSize",
"JournalHighlightColor",
"JournalHighlight",
"replaceLanguages",
"customLanguages",
"omniglot",
"comprehendLanguages",
"truespeech",
"display-translated",
"hideTranslation",
"allowOOC",
"runifyGM",
let keys = [
"defaultLanguage"
];
await Promise.all(
keys.map(async (key) => {
await this.resetToDefault(key);
}),
);
if (game.user.isGM) {
keys = [
"RuneRegex",
"enableAllFonts",
"exportFonts",
"IgnoreJournalFontSize",
"JournalHighlightColor",
"JournalHighlight",
"replaceLanguages",
"defaultLanguage",
"customLanguages",
"omniglot",
"comprehendLanguages",
"truespeech",
"display-translated",
"hideTranslation",
"allowOOC",
"runifyGM",
];
await Promise.all(
keys.map(async (key) => {
await this.resetToDefault(key);
}),
);
} else {
await Promise.all(
keys.map(async (key) => {
await game.user.unsetFlag(key);
}),
);
}
this.close();
}
});
Expand Down

0 comments on commit 2a833d8

Please sign in to comment.