diff --git a/locales/en-US.yml b/locales/en-US.yml index acc33252a9..c489ec4d79 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -833,6 +833,8 @@ quitFullView: "Exit full view" addDescription: "Add description" userPagePinTip: "You can display notes here by selecting \"Pin to profile\" from the menu of individual notes." notSpecifiedMentionWarning: "This note contains mentions of users not included as recipients" +cwAndNonsensitiveFilesWarning: "This note has a content warning but its attachments are not marked as sensitive" +setAllFilesSensitive: "Mark all attachments sensitive" info: "About" userInfo: "User information" unknown: "Unknown" diff --git a/package.json b/package.json index 1c081db588..e131c0be27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sharkey", - "version": "2024.3.1+egirls.0", + "version": "2024.3.1+egirls.1", "codename": "shonk", "repository": { "type": "git", diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 099ceee3a1..5e78edd727 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -65,6 +65,7 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.notSpecifiedMentionWarning }} - + {{ i18n.ts.cwAndNonsensitiveFilesWarning }} -
@@ -198,6 +199,8 @@ const autocomplete = ref(null); const draghover = ref(false); const quoteId = ref(null); const hasNotSpecifiedMentions = ref(false); +const hasNonsensitiveFiles = ref(false); +watch(files, () => updateNonsensitiveFiles()); const recentHashtags = ref(JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]')); const imeText = ref(''); const showingOptions = ref(false); @@ -354,6 +357,8 @@ if (defaultStore.state.keepCw && props.reply && props.reply.cw) { cw.value = props.reply.cw; } +hasNonsensitiveFiles.value = files.value.length !== 0 && files.value.some((file) => !file.isSensitive); + function watchForDraft() { watch(text, () => saveDraft()); watch(useCw, () => saveDraft()); @@ -418,6 +423,10 @@ function focus() { } } +function updateNonsensitiveFiles() { + hasNonsensitiveFiles.value = files.value.length !== 0 && files.value.some((file) => !file.isSensitive); +} + function chooseFileFrom(ev) { if (props.mock) return; @@ -426,10 +435,14 @@ function chooseFileFrom(ev) { files.value.push(file); } }); + + updateNonsensitiveFiles(); } function detachFile(id) { files.value = files.value.filter(x => x.id !== id); + + updateNonsensitiveFiles(); } function updateFileSensitive(file, sensitive) { @@ -437,14 +450,20 @@ function updateFileSensitive(file, sensitive) { emit('fileChangeSensitive', file.id, sensitive); } files.value[files.value.findIndex(x => x.id === file.id)].isSensitive = sensitive; + + updateNonsensitiveFiles(); } function updateFileName(file, name) { files.value[files.value.findIndex(x => x.id === file.id)].name = name; + + updateNonsensitiveFiles(); } function replaceFile(file: Misskey.entities.DriveFile, newFile: Misskey.entities.DriveFile): void { files.value[files.value.findIndex(x => x.id === file.id)] = newFile; + + updateNonsensitiveFiles(); } function upload(file: File, name?: string): void { @@ -452,9 +471,25 @@ function upload(file: File, name?: string): void { uploadFile(file, defaultStore.state.uploadFolder, name).then(res => { files.value.push(res); + updateNonsensitiveFiles(); }); } +function setAllFilesSensitive() { + for (let file of files.value.values()) { + console.log(file, file.isSensitive); + if (!file.isSensitive) { + misskeyApi('drive/files/update', { + fileId: file.id, + isSensitive: true, + }).then((file) => { + console.log(file.id); + updateFileSensitive(file, file.isSensitive); + }); + } + } +} + function setVisibility() { if (props.channel) { visibility.value = 'public'; @@ -1198,7 +1233,7 @@ defineExpose({ background: var(--X4); } -.hasNotSpecifiedMentions { +.hasNotSpecifiedMentions, .hasCwAndNonsensitiveFiles { margin: 0 20px 16px 20px; }