Skip to content

Commit

Permalink
Enhance: クソデカMFMを使った投稿で出る警告をいい感じに
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyatea committed Nov 28, 2024
1 parent cd0aa48 commit f8f07a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4460,6 +4460,10 @@ export interface Locale extends ILocale {
* ホームに投稿
*/
"thisPostMayBeAnnoyingHome": string;
/**
* CWをつけて投稿
*/
"thisPostMayBeAnnoyingCW": string;
/**
* やめる
*/
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ gotInvalidResponseError: "サーバーの応答が無効です"
gotInvalidResponseErrorDescription: "サーバーがダウンまたはメンテナンスしている可能性があります。しばらくしてから再度お試しください。"
thisPostMayBeAnnoying: "この投稿は迷惑になる可能性があります。"
thisPostMayBeAnnoyingHome: "ホームに投稿"
thisPostMayBeAnnoyingCW: "CWをつけて投稿"
thisPostMayBeAnnoyingCancel: "やめる"
thisPostMayBeAnnoyingIgnore: "このまま投稿"
collapseRenotes: "リノートのスマート省略"
Expand Down
13 changes: 10 additions & 3 deletions packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import * as Misskey from 'misskey-js';
import insertTextAtCursor from 'insert-text-at-cursor';
import { toASCII } from 'punycode/';
import { host, url } from '@@/js/config.js';
import type { PostFormProps } from '@/types/post-form.js';
import MkNoteSimple from '@/components/MkNoteSimple.vue';
import MkNotePreview from '@/components/MkNotePreview.vue';
import XPostFormAttaches from '@/components/MkPostFormAttaches.vue';
Expand Down Expand Up @@ -143,7 +144,6 @@ import { emojiPicker } from '@/scripts/emoji-picker.js';
import { mfmFunctionPicker } from '@/scripts/mfm-function-picker.js';
import MkScheduleEditor from '@/components/MkScheduleEditor.vue';
import { listSchedulePost } from '@/os.js';
import type { PostFormProps } from '@/types/post-form.js';
const $i = signinRequired();
Expand Down Expand Up @@ -917,11 +917,15 @@ async function post(ev?: MouseEvent) {
text.value.includes('$[scale') ||
text.value.includes('$[position');
if (annoying && visibility.value === 'public') {
if (annoying && visibility.value === 'public' && !cw.value) {
const { canceled, result } = await os.actions({
type: 'warning',
text: i18n.ts.thisPostMayBeAnnoying,
actions: [{
value: 'cw',
text: i18n.ts.thisPostMayBeAnnoyingCW,
primary: true,
}, {
value: 'home',
text: i18n.ts.thisPostMayBeAnnoyingHome,
primary: true,
Expand All @@ -936,8 +940,11 @@ async function post(ev?: MouseEvent) {
if (canceled) return;
if (result === 'cancel') return;
if (result === 'cw') {
cw.value = '動きの激しいMFMを含んでいる投稿です';
}
if (result === 'home') {
visibility.value = 'home';
cw.value = '動きの激しいMFMを含んでいる投稿です';
}
}
Expand Down

0 comments on commit f8f07a7

Please sign in to comment.