From aa97455708eea1575561c865310c43fd2ab2ceb2 Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 28 Jun 2024 15:54:04 +0900 Subject: [PATCH] feat (client): add ability to append #Alt4Me automatically --- locales/en-US.yml | 1 + packages/client/src/account.ts | 2 +- packages/client/src/components/MkPostForm.vue | 7 +++++++ packages/client/src/pages/settings/general.vue | 16 ++++++++++------ .../src/pages/settings/preferences-backups.vue | 4 ++++ packages/client/src/store.ts | 4 ++++ 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 76e0c8edc4..137688b66c 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1238,6 +1238,7 @@ noAltTextWarning: "Some attached file(s) have no description. Did you forget to showNoAltTextWarning: "Show a warning if you attempt to post files without a description" showAddFileDescriptionAtFirstPost: "Automatically open a form to write a description when you attempt to post files without a description" +addAlt4MeTag: "Automatically append #Alt4Me hashtag to your post if attached file has no description" _emojiModPerm: unauthorized: "None" diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index 1d38b2798f..c4830f1210 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -7,7 +7,7 @@ import { alert, api, popup, popupMenu, waiting } from "@/os"; import icon from "@/scripts/icon"; import { del, get, set } from "@/scripts/idb-proxy"; import { reloadChannel, unisonReload } from "@/scripts/unison-reload"; -import type { MenuButton, MenuUser } from "./types/menu"; +import type { MenuUser } from "./types/menu"; // TODO: 他のタブと永続化されたstateを同期 diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index 85da6ac55a..ce1119ed82 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -1195,6 +1195,13 @@ async function post() { } } + if ( + defaultStore.state.addAlt4MeTag && + files.value.some((f) => f.comment == null || f.comment.length === 0) + ) { + text.value = `${text.value.trimEnd()}\n#Alt4Me`; + } + const processedText = preprocess(text.value); let postData: ApiTypes.NoteSubmitReq = { diff --git a/packages/client/src/pages/settings/general.vue b/packages/client/src/pages/settings/general.vue index 5f9d252253..54b9f4aa62 100644 --- a/packages/client/src/pages/settings/general.vue +++ b/packages/client/src/pages/settings/general.vue @@ -127,12 +127,6 @@ {{ i18n.ts.openServerInfo }} - {{ - i18n.ts.showNoAltTextWarning - }} - {{ - i18n.ts.showAddFileDescriptionAtFirstPost - }} {{ i18n.ts.autocorrectNoteLanguage }} @@ -191,6 +185,15 @@ + {{ + i18n.ts.showNoAltTextWarning + }} + {{ + i18n.ts.showAddFileDescriptionAtFirstPost + }} + {{ + i18n.ts.addAlt4MeTag + }} {{ i18n.ts.expandOnNoteClick }}