Remove duped remove clan tags setting
This commit is contained in:
parent
e03bc2c6d3
commit
a3319f762b
4 changed files with 18 additions and 24 deletions
|
|
@ -312,7 +312,6 @@ export function migrateSettingToPlugin(newName: string, oldName: string, setting
|
|||
|
||||
export function migrateSettingsFromPlugin(newPlugin: string, oldPlugin: string, ...settings: string[]) {
|
||||
const { plugins } = SettingsStore.plain;
|
||||
|
||||
const oldSettings = plugins[oldPlugin];
|
||||
const newSettings = plugins[newPlugin];
|
||||
if (!oldSettings || !newSettings) return;
|
||||
|
|
@ -330,6 +329,21 @@ export function migrateSettingsFromPlugin(newPlugin: string, oldPlugin: string,
|
|||
SettingsStore.markAsChanged();
|
||||
}
|
||||
|
||||
export function migrateOldSettingToNewPlugin(newPlugin: string, newSetting: string, oldPlugin: string, oldSetting: string,) {
|
||||
const { plugins } = SettingsStore.plain;
|
||||
const oldSettings = plugins[oldPlugin];
|
||||
const newSettings = plugins[newPlugin];
|
||||
if (!oldSettings || !newSettings) return;
|
||||
|
||||
if (!Object.hasOwn(oldSettings, oldSetting) || Object.hasOwn(newSettings, newSetting)) return;
|
||||
|
||||
logger.info(`Migrating plugin setting "${oldSetting}" from ${oldPlugin} to "${newSetting}" on ${newPlugin}`);
|
||||
|
||||
newSettings[newSetting] = oldSettings[oldSetting];
|
||||
delete oldSettings[oldSetting];
|
||||
SettingsStore.markAsChanged();
|
||||
}
|
||||
|
||||
export function definePluginSettings<
|
||||
Def extends SettingsDefinition,
|
||||
Checks extends SettingsChecks<Def>,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import "./style.css";
|
||||
|
||||
import { definePluginSettings, migratePluginSetting, migratePluginSettings } from "@api/Settings";
|
||||
import { definePluginSettings, migrateOldSettingToNewPlugin, migratePluginSetting, migratePluginSettings } from "@api/Settings";
|
||||
import { Divider } from "@components/Divider";
|
||||
import { HeadingSecondary } from "@components/Heading";
|
||||
import { Notice } from "@components/Notice";
|
||||
|
|
@ -15,6 +15,7 @@ import { Devs, EquicordDevs } from "@utils/index";
|
|||
import definePlugin, { OptionType } from "@utils/types";
|
||||
|
||||
migratePluginSettings("Declutter", "BetterUserArea", "Anammox");
|
||||
migrateOldSettingToNewPlugin("Declutter", "removeClanTag", "GuildTagSettings", "hideTags");
|
||||
|
||||
const migrationsAnammox = [
|
||||
["dms", "removeShopAboveDM"],
|
||||
|
|
|
|||
|
|
@ -17,22 +17,10 @@
|
|||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { disableStyle, enableStyle } from "@api/Styles";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
|
||||
import clanBadges from "./styles.css?managed";
|
||||
|
||||
const settings = definePluginSettings({
|
||||
hideTags: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Hide tags",
|
||||
default: false,
|
||||
onChange: value => {
|
||||
if (value) enableStyle(clanBadges);
|
||||
else disableStyle(clanBadges);
|
||||
}
|
||||
},
|
||||
disableAdoptTagPrompt: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Disable the prompt to adopt tags",
|
||||
|
|
@ -55,11 +43,5 @@ export default definePlugin({
|
|||
},
|
||||
predicate: () => settings.store.disableAdoptTagPrompt
|
||||
}
|
||||
],
|
||||
start() {
|
||||
if (settings.store.hideTags) enableStyle(clanBadges);
|
||||
},
|
||||
stop() {
|
||||
if (settings.store.hideTags) disableStyle(clanBadges);
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
[class*="chipletContainerInner"]:has([src *="/clan-badges/"]) {
|
||||
display: none;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue