summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkPostForm.vue
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-02-07 15:54:52 +0900
committerGitHub <noreply@github.com>2025-02-07 06:54:52 +0000
commitd008394eb76b7b615258667dbba3d2e12acdf0f3 (patch)
tree9a5d4b29508e32e55e852e4d76302f79da88ae46 /packages/frontend/src/components/MkPostForm.vue
parentfix: swcのjson-schemaのurlを変更 (#15409) (diff)
downloadsharkey-d008394eb76b7b615258667dbba3d2e12acdf0f3.tar.gz
sharkey-d008394eb76b7b615258667dbba3d2e12acdf0f3.tar.bz2
sharkey-d008394eb76b7b615258667dbba3d2e12acdf0f3.zip
enhance(frontend): PostFormのannoying判定でCWを考慮するように (#15405)
* enhance(frontend): PostFormのannoying判定でCWを考慮するように * Update Changelog * Update CHANGELOG.md
Diffstat (limited to 'packages/frontend/src/components/MkPostForm.vue')
-rw-r--r--packages/frontend/src/components/MkPostForm.vue20
1 files changed, 12 insertions, 8 deletions
diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue
index 4f2792ed40..49ed4197de 100644
--- a/packages/frontend/src/components/MkPostForm.vue
+++ b/packages/frontend/src/components/MkPostForm.vue
@@ -721,6 +721,14 @@ function deleteDraft() {
miLocalStorage.setItem('drafts', JSON.stringify(draftData));
}
+function isAnnoying(text: string): boolean {
+ return text.includes('$[x2') ||
+ text.includes('$[x3') ||
+ text.includes('$[x4') ||
+ text.includes('$[scale') ||
+ text.includes('$[position');
+}
+
async function post(ev?: MouseEvent) {
if (useCw.value && (cw.value == null || cw.value.trim() === '')) {
os.alert({
@@ -745,14 +753,10 @@ async function post(ev?: MouseEvent) {
if (props.mock) return;
- const annoying =
- text.value.includes('$[x2') ||
- text.value.includes('$[x3') ||
- text.value.includes('$[x4') ||
- text.value.includes('$[scale') ||
- text.value.includes('$[position');
-
- if (annoying && visibility.value === 'public') {
+ if (visibility.value === 'public' && (
+ (useCw.value && cw.value != null && cw.value.trim() !== '' && isAnnoying(cw.value)) || // CWが迷惑になる場合
+ ((!useCw.value || cw.value == null || cw.value.trim() === '') && text.value != null && text.value.trim() !== '' && isAnnoying(text.value)) // CWが無い かつ 本文が迷惑になる場合
+ )) {
const { canceled, result } = await os.actions({
type: 'warning',
text: i18n.ts.thisPostMayBeAnnoying,