feat(moreusertags): add option to not show more tags for bots (#812)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Ryan Cao 2023-04-07 08:31:21 +08:00 committed by GitHub
parent 97f8d4d515
commit 2a0c30b66d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,6 +83,10 @@ const tags: Tag[] = [
]; ];
const settings = definePluginSettings({ const settings = definePluginSettings({
dontShowForBots: {
description: "Don't show tags (not including the webhook tag) for bots",
type: OptionType.BOOLEAN
},
dontShowBotTag: { dontShowBotTag: {
description: "Don't show [BOT] text for bots with other tags (verified bots will still have checkmark)", description: "Don't show [BOT] text for bots with other tags (verified bots will still have checkmark)",
type: OptionType.BOOLEAN type: OptionType.BOOLEAN
@ -214,6 +218,8 @@ return type!==null?$2.botTag,type"
const [tagName, variant] = passedTagName.split("-"); const [tagName, variant] = passedTagName.split("-");
const tag = tags.find(({ name }) => tagName === name); const tag = tags.find(({ name }) => tagName === name);
if (!tag) return "BOT"; if (!tag) return "BOT";
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return strings.BOT_TAG_BOT;
switch (variant) { switch (variant) {
case "OP": case "OP":
return `${strings.BOT_TAG_FORUM_ORIGINAL_POSTER}${tag.displayName}`; return `${strings.BOT_TAG_FORUM_ORIGINAL_POSTER}${tag.displayName}`;