enhance(client): 迷惑になる可能性のある投稿を行う前に警告を表示

Resolve #9862
This commit is contained in:
syuilo 2023-02-11 13:54:27 +09:00
parent 0138c3b00e
commit 73a1372940
5 changed files with 68 additions and 1 deletions

View file

@ -579,6 +579,36 @@ async function post(ev?: MouseEvent) {
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
const annoying =
text.includes('$[x2') ||
text.includes('$[x3') ||
text.includes('$[x4') ||
text.includes('$[scale') ||
text.includes('$[position');
if (annoying) {
const { canceled, result } = await os.actions({
type: 'warning',
text: i18n.ts.thisPostMayBeAnnoying,
actions: [{
value: 'home',
text: i18n.ts.thisPostMayBeAnnoyingHome,
primary: true,
}, {
value: 'cancel',
text: i18n.ts.thisPostMayBeAnnoyingCancel,
}, {
value: 'ignore',
text: i18n.ts.thisPostMayBeAnnoyingIgnore,
}],
});
if (canceled) return;
if (result === 'cancel') return;
if (result === 'home') {
visibility = 'home';
}
}
let postData = {
text: text === '' ? undefined : text,
fileIds: files.length > 0 ? files.map(f => f.id) : undefined,