enhance(frontend): PostFormのannoying判定でCWを考慮するように (#15405)

* enhance(frontend): PostFormのannoying判定でCWを考慮するように

* Update Changelog

* Update CHANGELOG.md
This commit is contained in:
かっこかり
2025-02-07 15:54:52 +09:00
committed by GitHub
parent 47a76bbc4c
commit d008394eb7
2 changed files with 13 additions and 9 deletions

View File

@@ -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,