From 6384f9ac8ee85781411259bf9aaac1a85475ef59 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Wed, 25 Dec 2024 18:22:21 +0100 Subject: [PATCH] feat: :triangular_flag_on_post: Add default note visibility preference --- components/composer/composer.vue | 3 ++- messages/en-pt.json | 5 ++++- messages/en-rot.json | 4 +++- messages/en.json | 4 +++- messages/fr.json | 6 ++++-- settings.ts | 26 ++++++++++++++++++++++++++ 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/components/composer/composer.vue b/components/composer/composer.vue index 7729bc9..dfe46cf 100644 --- a/components/composer/composer.vue +++ b/components/composer/composer.vue @@ -120,6 +120,7 @@ import Files from "./files.vue"; const { Control_Enter, Command_Enter } = useMagicKeys(); const ctrlEnterSend = useSetting(SettingIds.CtrlEnterToSend); +const defaultVisibility = useSetting(SettingIds.DefaultVisibility); const { play } = useAudio(); const fileInput = ref(null); @@ -178,7 +179,7 @@ const state = reactive({ contentType: "text/markdown" as "text/markdown" | "text/plain", visibility: (relation?.type === "edit" ? relation.note.visibility - : "public") as Status["visibility"], + : (defaultVisibility.value.value ?? "public")) as Status["visibility"], files: (relation?.type === "edit" ? relation.note.media_attachments.map((a) => ({ apiId: a.id, diff --git a/messages/en-pt.json b/messages/en-pt.json index cd457dd..995294e 100644 --- a/messages/en-pt.json +++ b/messages/en-pt.json @@ -316,6 +316,7 @@ "tired_happy_lobster_pet": "Change the ship's language. Requires resetting yer sails to apply.", "keen_aware_goldfish_thrive": "King's English", "vivid_mellow_sawfish_approve": "Fancy French", + "these_awful_ape_reside": "Pirate", "gray_clean_shark_comfort": "The following URI parameters be required:", "grand_spry_goldfish_embrace": "Yer URI parameters be invalid", "honest_factual_carp_aspire": "Be yer certain yer want to send this deck decoration to Davy Jones' locker?", @@ -342,5 +343,7 @@ "inclusive_long_lizard_boost": "Gravatar", "proud_next_elk_beam": "URL", "lower_formal_kudu_lift": "Gravatar email", - "witty_honest_wallaby_support": "Preview" + "witty_honest_wallaby_support": "Preview", + "loud_tense_kitten_exhale": "Default Visibility", + "vivid_last_crocodile_offer": "The default visibility for new notes." } diff --git a/messages/en-rot.json b/messages/en-rot.json index 5469131..6007e62 100644 --- a/messages/en-rot.json +++ b/messages/en-rot.json @@ -343,5 +343,7 @@ "inclusive_long_lizard_boost": "Gravatar", "proud_next_elk_beam": "URL", "lower_formal_kudu_lift": "Gravatar email", - "witty_honest_wallaby_support": "Preview" + "witty_honest_wallaby_support": "Preview", + "loud_tense_kitten_exhale": "Default Visibility", + "vivid_last_crocodile_offer": "The default visibility for new notes." } diff --git a/messages/en.json b/messages/en.json index 7f28f77..6adac3a 100644 --- a/messages/en.json +++ b/messages/en.json @@ -345,5 +345,7 @@ "inclusive_long_lizard_boost": "Gravatar", "proud_next_elk_beam": "URL", "lower_formal_kudu_lift": "Gravatar email", - "witty_honest_wallaby_support": "Preview" + "witty_honest_wallaby_support": "Preview", + "loud_tense_kitten_exhale": "Default Visibility", + "vivid_last_crocodile_offer": "The default visibility for new notes." } diff --git a/messages/fr.json b/messages/fr.json index 2576e58..fd1bf44 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -321,11 +321,13 @@ "kind_deft_myna_hint": "Échec de l'ajout de l'emoji.", "frail_great_marten_pet": "Ajoutez un nouvel emoji sur le serveur.", "whole_icy_puffin_smile": "Ajouter un Emoji", - "dirty_inclusive_meerkat_nudge": "Annuler", "due_hour_husky_prosper": "Changer l'image", "suave_broad_albatross_drop": "Ajoutez une image, un e-mail Gravatar ou utilisez une URL.", "inclusive_long_lizard_boost": "Gravatar", "proud_next_elk_beam": "URL", "lower_formal_kudu_lift": "E-mail Gravatar", - "witty_honest_wallaby_support": "Aperçu" + "witty_honest_wallaby_support": "Aperçu", + "dirty_inclusive_meerkat_nudge": "Annuler", + "loud_tense_kitten_exhale": "Visibilité par défaut", + "vivid_last_crocodile_offer": "La visibilité par défaut pour les nouvelles notes." } diff --git a/settings.ts b/settings.ts index 3c8cc4a..993b8c8 100644 --- a/settings.ts +++ b/settings.ts @@ -87,6 +87,7 @@ export enum SettingIds { NotificationsSidebar = "notifications-sidebar", AvatarShape = "avatar-shape", SidebarStyle = "sidebar-style", + DefaultVisibility = "default-visibility", } export const settings = (): Record => { @@ -99,6 +100,31 @@ export const settings = (): Record => { page: SettingPages.Behaviour, notImplemented: true, } as BooleanSetting, + [SettingIds.DefaultVisibility]: { + title: m.loud_tense_kitten_exhale, + description: m.vivid_last_crocodile_offer, + type: SettingType.Enum, + value: "public", + options: [ + { + value: "public", + label: m.lost_trick_dog_grace, + }, + { + value: "unlisted", + label: m.funny_slow_jannes_walk, + }, + { + value: "private", + label: m.grassy_empty_raven_startle, + }, + { + value: "direct", + label: m.pretty_bold_baboon_wave, + }, + ], + page: SettingPages.Behaviour, + } as EnumSetting, [SettingIds.Language]: { title: m.pretty_born_jackal_dial, description: m.tired_happy_lobster_pet,