From d434343a09f99f6226d9853d24d7ac0d47eb1ee7 Mon Sep 17 00:00:00 2001 From: Chloe Kudryavtsev Date: Wed, 17 Aug 2022 17:14:58 -0400 Subject: [PATCH] client: fix default-selected reply scopes As a side-effect, I remove the broken "remember privacy scope" setting. Co-authored-by: Johann150 Changelog: Fixed --- locales/ar-SA.yml | 1 - locales/bn-BD.yml | 1 - locales/ca-ES.yml | 1 - locales/cs-CZ.yml | 1 - locales/de-DE.yml | 1 - locales/en-US.yml | 1 - locales/es-ES.yml | 1 - locales/fr-FR.yml | 1 - locales/id-ID.yml | 1 - locales/it-IT.yml | 1 - locales/ja-JP.yml | 1 - locales/ja-KS.yml | 1 - locales/ko-KR.yml | 1 - locales/nl-NL.yml | 1 - locales/pl-PL.yml | 1 - locales/pt-PT.yml | 1 - locales/ro-RO.yml | 1 - locales/ru-RU.yml | 1 - locales/sk-SK.yml | 1 - locales/sv-SE.yml | 1 - locales/uk-UA.yml | 1 - locales/vi-VN.yml | 1 - locales/zh-CN.yml | 1 - locales/zh-TW.yml | 1 - packages/client/src/components/post-form.vue | 38 +++++++++++-------- .../client/src/pages/settings/privacy.vue | 4 +- packages/client/src/store.ts | 12 ------ 27 files changed, 24 insertions(+), 54 deletions(-) diff --git a/locales/ar-SA.yml b/locales/ar-SA.yml index 62d6d27d4..979020f6a 100644 --- a/locales/ar-SA.yml +++ b/locales/ar-SA.yml @@ -108,7 +108,6 @@ add: "إضافة" reaction: "التفاعلات" reactionSetting: "التفاعلات المراد عرضها في منتقي التفاعلات." reactionSettingDescription2: "اسحب لترتيب ، انقر للحذف ، استخدم \"+\" للإضافة." -rememberNoteVisibility: "تذكر إعدادت مدى رؤية الملاحظات" attachCancel: "أزل المرفق" markAsSensitive: "علّمه كمحتوى حساس" unmarkAsSensitive: "ألغ تعيينه كمحتوى حساس" diff --git a/locales/bn-BD.yml b/locales/bn-BD.yml index ae3d6b8d0..6b0cbf416 100644 --- a/locales/bn-BD.yml +++ b/locales/bn-BD.yml @@ -108,7 +108,6 @@ add: "যুক্ত করুন" reaction: "প্রতিক্রিয়া" reactionSetting: "রিঅ্যাকশন পিকারে যেসকল প্রতিক্রিয়া দেখানো হবে" reactionSettingDescription2: "পুনরায় সাজাতে টেনে আনুন, মুছতে ক্লিক করুন, যোগ করতে + টিপুন।" -rememberNoteVisibility: "নোটের দৃশ্যমান্যতার সেটিংস মনে রাখুন" attachCancel: "অ্যাটাচমেন্ট সরান " markAsSensitive: "সংবেদনশীল হিসাবে চিহ্নিত করুন" unmarkAsSensitive: "সংবেদনশীল চিহ্ন সরান" diff --git a/locales/ca-ES.yml b/locales/ca-ES.yml index 49b72c0ea..e8eec563c 100644 --- a/locales/ca-ES.yml +++ b/locales/ca-ES.yml @@ -108,7 +108,6 @@ add: "Afegir" reaction: "Reaccions" reactionSetting: "Reaccions a mostrar al selector de reaccions" reactionSettingDescription2: "Arrossega per reordenar, fes clic per suprimir, prem \"+\" per afegir." -rememberNoteVisibility: "Recorda la configuració de visibilitat de les notes" attachCancel: "Eliminar el fitxer adjunt" markAsSensitive: "Marcar com a NSFW" instances: "Instàncies" diff --git a/locales/cs-CZ.yml b/locales/cs-CZ.yml index 77850a1eb..4e2b7624f 100644 --- a/locales/cs-CZ.yml +++ b/locales/cs-CZ.yml @@ -105,7 +105,6 @@ sensitive: "NSFW" add: "Přidat" reaction: "Reakce" reactionSettingDescription2: "Přetažením změníte pořadí, kliknutím smažete, zmáčkněte \"+\" k přidání" -rememberNoteVisibility: "Zapamatovat nastavení zobrazení poznámky" attachCancel: "Odstranit přílohu" markAsSensitive: "Označit jako NSFW" unmarkAsSensitive: "Odznačit jako NSFW" diff --git a/locales/de-DE.yml b/locales/de-DE.yml index d04480e43..dbda4ebb9 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -109,7 +109,6 @@ add: "Hinzufügen" reaction: "Reaktionen" reactionSetting: "In der Reaktionsauswahl anzuzeigende Reaktionen" reactionSettingDescription2: "Ziehe um Anzuordnen, klicke um zu löschen, drücke „+“ um hinzuzufügen" -rememberNoteVisibility: "Notizsichtbarkeit merken" attachCancel: "Anhang entfernen" markAsSensitive: "Als NSFW markieren" unmarkAsSensitive: "Als nicht NSFW markieren" diff --git a/locales/en-US.yml b/locales/en-US.yml index db041e692..35e13beb5 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -109,7 +109,6 @@ add: "Add" reaction: "Reactions" reactionSetting: "Reactions to show in the reaction picker" reactionSettingDescription2: "Drag to reorder, click to delete, press \"+\" to add." -rememberNoteVisibility: "Remember note visibility settings" attachCancel: "Remove attachment" markAsSensitive: "Mark as NSFW" unmarkAsSensitive: "Unmark as NSFW" diff --git a/locales/es-ES.yml b/locales/es-ES.yml index 26d07f29f..a72b8c4e9 100644 --- a/locales/es-ES.yml +++ b/locales/es-ES.yml @@ -108,7 +108,6 @@ add: "Agregar" reaction: "Reacción" reactionSetting: "Reacciones para mostrar en el menú de reacciones" reactionSettingDescription2: "Arrastre para reordenar, click para borrar, apriete la tecla + para añadir." -rememberNoteVisibility: "Recordar visibilidad" attachCancel: "Quitar adjunto" markAsSensitive: "Marcar como sensible" unmarkAsSensitive: "Desmarcar como sensible" diff --git a/locales/fr-FR.yml b/locales/fr-FR.yml index 9a12c9c6a..6c372781e 100644 --- a/locales/fr-FR.yml +++ b/locales/fr-FR.yml @@ -108,7 +108,6 @@ add: "Ajouter" reaction: "Réactions" reactionSetting: "Réactions à afficher dans le sélecteur de réactions" reactionSettingDescription2: "Déplacer pour réorganiser, cliquer pour effacer, utiliser « + » pour ajouter." -rememberNoteVisibility: "Activer l'option \" se souvenir de la visibilité des notes \" vous permet de réutiliser automatiquement la visibilité utilisée lors de la publication de votre note précédente." attachCancel: "Supprimer le fichier attaché" markAsSensitive: "Marquer comme sensible" unmarkAsSensitive: "Supprimer le marquage comme sensible" diff --git a/locales/id-ID.yml b/locales/id-ID.yml index a81cc63bc..452f390e0 100644 --- a/locales/id-ID.yml +++ b/locales/id-ID.yml @@ -108,7 +108,6 @@ add: "Tambahkan" reaction: "Reaksi" reactionSetting: "Reaksi untuk dimunculkan di bilah reaksi" reactionSettingDescription2: "Geser untuk memindah urutkan, klik untuk menghapus, tekan \"+\" untuk menambahkan" -rememberNoteVisibility: "Ingat pengaturan visibilitas catatan" attachCancel: "Hapus lampiran" markAsSensitive: "Tandai sebagai konten sensitif" unmarkAsSensitive: "Hapus tanda konten sensitif" diff --git a/locales/it-IT.yml b/locales/it-IT.yml index 9eeeb0c53..561996e92 100644 --- a/locales/it-IT.yml +++ b/locales/it-IT.yml @@ -108,7 +108,6 @@ add: "Aggiungi" reaction: "Reazione" reactionSetting: "Reazioni visualizzate sul pannello" reactionSettingDescription2: "Trascina per riorganizzare, clicca per cancellare, usa il pulsante \"+\" per aggiungere." -rememberNoteVisibility: "Ricordare le impostazioni di visibilità delle note" attachCancel: "Rimuovi allegato" markAsSensitive: "Segna come sensibile" unmarkAsSensitive: "Segna come non sensibile" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 4dfe98e74..f8ef41ea0 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -109,7 +109,6 @@ add: "追加" reaction: "リアクション" reactionSetting: "ピッカーに表示するリアクション" reactionSettingDescription2: "ドラッグして並び替え、クリックして削除、+を押して追加します。" -rememberNoteVisibility: "公開範囲を記憶する" attachCancel: "添付取り消し" markAsSensitive: "閲覧注意にする" unmarkAsSensitive: "閲覧注意を解除する" diff --git a/locales/ja-KS.yml b/locales/ja-KS.yml index 859142926..50e36821e 100644 --- a/locales/ja-KS.yml +++ b/locales/ja-KS.yml @@ -108,7 +108,6 @@ add: "増やす" reaction: "リアクション" reactionSetting: "Reaction that will be displayed in Picker. " reactionSettingDescription2: "ドラッグで並び替え、クリックで削除、+を押して追加やで。" -rememberNoteVisibility: "公開範囲覚えといて" attachCancel: "のっけるのやめる" markAsSensitive: "ちょっとこれはアカン" unmarkAsSensitive: "そこまでアカンことないやろ" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index b6ba5c91d..4f8cac7cb 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -108,7 +108,6 @@ add: "추가" reaction: "리액션" reactionSetting: "선택기에 표시할 리액션" reactionSettingDescription2: "끌어서 순서 변경, 클릭해서 삭제, +를 눌러서 추가할 수 있습니다." -rememberNoteVisibility: "공개 범위를 기억하기" attachCancel: "첨부 취소" markAsSensitive: "열람주의로 설정" unmarkAsSensitive: "열람주의 해제" diff --git a/locales/nl-NL.yml b/locales/nl-NL.yml index e0d4cd08a..d386c08b4 100644 --- a/locales/nl-NL.yml +++ b/locales/nl-NL.yml @@ -108,7 +108,6 @@ sensitive: "NSFW" add: "Toevoegen" reaction: "Reacties" reactionSettingDescription2: "Sleep om opnieuw te ordenen, Klik om te verwijderen, Druk op \"+\" om toe te voegen" -rememberNoteVisibility: "Vergeet niet de notitie zichtbaarheidsinstellingen" attachCancel: "Verwijder bijlage" markAsSensitive: "Markeren als NSFW" unmarkAsSensitive: "Geen NSFW" diff --git a/locales/pl-PL.yml b/locales/pl-PL.yml index 45f6ed409..ddc284350 100644 --- a/locales/pl-PL.yml +++ b/locales/pl-PL.yml @@ -108,7 +108,6 @@ add: "Dodaj" reaction: "Reakcja" reactionSetting: "Reakcje do pokazania w wyborniku reakcji" reactionSettingDescription2: "Przeciągnij aby zmienić kolejność, naciśnij aby usunąć, naciśnij „+” aby dodać" -rememberNoteVisibility: "Zapamiętuj ustawienia widoczności wpisu" attachCancel: "Usuń załącznik" markAsSensitive: "Oznacz jako NSFW" unmarkAsSensitive: "Cofnij NSFW" diff --git a/locales/pt-PT.yml b/locales/pt-PT.yml index c197529bb..e10b6136a 100644 --- a/locales/pt-PT.yml +++ b/locales/pt-PT.yml @@ -106,7 +106,6 @@ sensitive: "Conteúdo sensível" add: "Adicionar" reaction: "Reações" reactionSetting: "Quais reações a mostrar no selecionador de reações" -rememberNoteVisibility: "Lembrar das configurações de visibilidade de notas" attachCancel: "Remover anexo" markAsSensitive: "Marcar como sensível" unmarkAsSensitive: "Desmarcar como sensível" diff --git a/locales/ro-RO.yml b/locales/ro-RO.yml index 34d5d4f28..fe0063026 100644 --- a/locales/ro-RO.yml +++ b/locales/ro-RO.yml @@ -108,7 +108,6 @@ add: "Adaugă" reaction: "Reacție" reactionSetting: "Reacții care să apară in selectorul de reacții" reactionSettingDescription2: "Trage pentru a rearanja, apasă pe \"+\" pentru a adăuga." -rememberNoteVisibility: "Amintește setarea de vizibilitate a notelor" attachCancel: "Înlătură atașament" markAsSensitive: "Marchează ca NSFW" unmarkAsSensitive: "Demarchează ca NSFW" diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml index ad98d75cf..a79ae6e4b 100644 --- a/locales/ru-RU.yml +++ b/locales/ru-RU.yml @@ -108,7 +108,6 @@ add: "Добавить" reaction: "Реакции" reactionSetting: "Реакции, отображаемые в палитре" reactionSettingDescription2: "Расставляйте перетаскиванием, удаляйте нажатием, добавляйте кнопкой «+»." -rememberNoteVisibility: "Запоминать видимость заметок" attachCancel: "Удалить вложение" markAsSensitive: "Отметить как «не для всех»" unmarkAsSensitive: "Снять отметку «не для всех»" diff --git a/locales/sk-SK.yml b/locales/sk-SK.yml index 3a63e8511..bbe412ba5 100644 --- a/locales/sk-SK.yml +++ b/locales/sk-SK.yml @@ -108,7 +108,6 @@ add: "Pridať" reaction: "Reakcie" reactionSetting: "Reakcie zobrazené vo výbere reakcií" reactionSettingDescription2: "Ťahaním preusporiadate, kliknutím odstránite, Stlačením \"+\" pridáte" -rememberNoteVisibility: "Zapamätať nastavenia viditeľnosti poznámky" attachCancel: "Odstrániť prílohu" markAsSensitive: "Označiť ako NSFW" unmarkAsSensitive: "Odznačiť NSFW" diff --git a/locales/sv-SE.yml b/locales/sv-SE.yml index cc0720363..19b32c20b 100644 --- a/locales/sv-SE.yml +++ b/locales/sv-SE.yml @@ -108,7 +108,6 @@ add: "Lägg till" reaction: "Reaktioner" reactionSetting: "Reaktioner som ska visas i reaktionsväljaren" reactionSettingDescription2: "Dra för att omordna, klicka för att radera, tryck \"+\" för att lägga till." -rememberNoteVisibility: "Komihåg notvisningsinställningar" attachCancel: "Ta bort bilaga" markAsSensitive: "Markera som känsligt innehåll" unmarkAsSensitive: "Avmarkera som känsligt innehåll" diff --git a/locales/uk-UA.yml b/locales/uk-UA.yml index f9435cbb2..4ae094a01 100644 --- a/locales/uk-UA.yml +++ b/locales/uk-UA.yml @@ -108,7 +108,6 @@ add: "Додати" reaction: "Реакції" reactionSetting: "Налаштування реакцій" reactionSettingDescription2: "Перемістити щоб змінити порядок, Клацнути мишою щоб видалити, Натиснути \"+\" щоб додати." -rememberNoteVisibility: "Пам’ятати параметри видимісті" attachCancel: "Видалити вкладення" markAsSensitive: "Позначити як NSFW" unmarkAsSensitive: "Зняти позначку NSFW" diff --git a/locales/vi-VN.yml b/locales/vi-VN.yml index 15ceccba0..3d133fc95 100644 --- a/locales/vi-VN.yml +++ b/locales/vi-VN.yml @@ -108,7 +108,6 @@ add: "Thêm" reaction: "Biểu cảm" reactionSetting: "Chọn những biểu cảm hiển thị" reactionSettingDescription2: "Kéo để sắp xếp, nhấn để xóa, nhấn \"+\" để thêm." -rememberNoteVisibility: "Lưu kiểu tút mặc định" attachCancel: "Gỡ tập tin đính kèm" markAsSensitive: "Đánh dấu là nhạy cảm" unmarkAsSensitive: "Bỏ đánh dấu nhạy cảm" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index 6e693dcac..73e862c20 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -108,7 +108,6 @@ add: "添加" reaction: "回应" reactionSetting: "在选择器中显示的回应" reactionSettingDescription2: "拖动重新排序,单击删除,点击 + 添加。" -rememberNoteVisibility: "保存上次设置的可见性" attachCancel: "删除附件" markAsSensitive: "标记为敏感内容" unmarkAsSensitive: "取消标记为敏感内容" diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index 6332632a0..c24511e5f 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -108,7 +108,6 @@ add: "新增" reaction: "情感" reactionSetting: "在選擇器中顯示反應" reactionSettingDescription2: "拖動以重新列序,點擊以刪除,按下 + 添加。" -rememberNoteVisibility: "記住貼文可見性" attachCancel: "移除附件" markAsSensitive: "標記為敏感內容" unmarkAsSensitive: "取消標記為敏感內容" diff --git a/packages/client/src/components/post-form.vue b/packages/client/src/components/post-form.vue index 0fe41b76d..09be0c192 100644 --- a/packages/client/src/components/post-form.vue +++ b/packages/client/src/components/post-form.vue @@ -15,9 +15,9 @@ @@ -133,8 +133,8 @@ let poll = $ref<{ let useCw = $ref(false); let showPreview = $ref(false); let cw = $ref(null); -let localOnly = $ref(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly); -let visibility = $ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof foundkey.noteVisibilities[number]); +let localOnly = $ref(props.initialLocalOnly ?? defaultStore.state.defaultNoteLocalOnly); +let visibility = $ref(props.initialVisibility ?? defaultStore.state.defaultNoteVisibility as typeof foundkey.noteVisibilities[number]); let visibleUsers = $ref([]); if (props.initialVisibleUsers) { props.initialVisibleUsers.forEach(pushVisibleUser); @@ -144,6 +144,21 @@ let hasNotSpecifiedMentions = $ref(false); let recentHashtags = $ref(JSON.parse(localStorage.getItem('hashtags') || '[]')); let imeText = $ref(''); +// TODO: compat with misskey-js, should likely be moved into foundkey-js +const visibilityScore = (a: string): number => { + switch (a) { + case 'specified': + return 0; + case 'followers': + return 1; + case 'home': + return 2; + case 'public': default: + return 3; + } +}; +const minVisibility = (a: string, b: string): string => visibilityScore(b) > visibilityScore(a) ? a : b; + const typing = throttle(3000, () => { if (props.channel) { stream.send('typingOnChannel', { channel: props.channel.id }); @@ -255,10 +270,9 @@ if (props.channel) { localOnly = true; // TODO: チャンネルが連合するようになった折には消す } -// 公開以外へのリプライ時は元の公開範囲を引き継ぐ -if (props.reply && ['home', 'followers', 'specified'].includes(props.reply.visibility)) { - visibility = props.reply.visibility; - if (props.reply.visibility === 'specified') { +if (props.reply) { + visibility = minVisibility(props.reply.visibility, visibility); + if (visibility === 'specified') { os.api('users/show', { userIds: props.reply.visibleUserIds.filter(uid => uid !== $i.id && uid !== props.reply.userId), }).then(users => { @@ -383,15 +397,9 @@ function setVisibility() { }, { changeVisibility: v => { visibility = v; - if (defaultStore.state.rememberNoteVisibility) { - defaultStore.set('visibility', visibility); - } }, changeLocalOnly: v => { localOnly = v; - if (defaultStore.state.rememberNoteVisibility) { - defaultStore.set('localOnly', localOnly); - } }, }, 'closed'); } diff --git a/packages/client/src/pages/settings/privacy.vue b/packages/client/src/pages/settings/privacy.vue index c9c949999..89a051558 100644 --- a/packages/client/src/pages/settings/privacy.vue +++ b/packages/client/src/pages/settings/privacy.vue @@ -30,8 +30,7 @@ - {{ i18n.ts.rememberNoteVisibility }} - + @@ -73,7 +72,6 @@ let ffVisibility = $ref($i.ffVisibility); let defaultNoteVisibility = $computed(defaultStore.makeGetterSetter('defaultNoteVisibility')); let defaultNoteLocalOnly = $computed(defaultStore.makeGetterSetter('defaultNoteLocalOnly')); -let rememberNoteVisibility = $computed(defaultStore.makeGetterSetter('rememberNoteVisibility')); let keepCw = $computed(defaultStore.makeGetterSetter('keepCw')); function save() { diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index 5084907cf..a87c9f664 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -23,10 +23,6 @@ export const defaultStore = markRaw(new Storage('base', { where: 'account', default: false, }, - rememberNoteVisibility: { - where: 'account', - default: false, - }, defaultNoteVisibility: { where: 'account', default: 'public', @@ -75,14 +71,6 @@ export const defaultStore = markRaw(new Storage('base', { 'ui', ], }, - visibility: { - where: 'deviceAccount', - default: 'public' as 'public' | 'home' | 'followers' | 'specified', - }, - localOnly: { - where: 'deviceAccount', - default: false, - }, widgets: { where: 'deviceAccount', default: [] as {