From 75db6a7726b42fb49a92820316fa6102f41c357b Mon Sep 17 00:00:00 2001 From: Evan Paterakis Date: Fri, 8 Mar 2024 20:02:13 +0200 Subject: [PATCH] feat(store): sync post privacy with instance (#827) --- src/API/Account/Source.vala | 1 + src/Services/Accounts/AccountStore.vala | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/API/Account/Source.vala b/src/API/Account/Source.vala index e1dc6c785..9094f4db3 100644 --- a/src/API/Account/Source.vala +++ b/src/API/Account/Source.vala @@ -1,6 +1,7 @@ public class Tuba.API.AccountSource : Entity { public string language { get; set; default = ""; } public string note { get; set; default = ""; } + public string privacy { get; set; default = ""; } public Gee.ArrayList? fields { get; set; default=null; } public override Type deserialize_array_type (string prop) { diff --git a/src/Services/Accounts/AccountStore.vala b/src/Services/Accounts/AccountStore.vala index b45f3ac59..99da0708c 100644 --- a/src/Services/Accounts/AccountStore.vala +++ b/src/Services/Accounts/AccountStore.vala @@ -91,8 +91,13 @@ public abstract class Tuba.AccountStore : GLib.Object { account.verify_credentials.end (res); account.error = null; settings.active_account = account.uuid; - if (account.source != null && account.source.language != null && account.source.language != "") - settings.default_language = account.source.language; + if (account.source != null) { + if (account.source.language != null && account.source.language != "") settings.default_language = account.source.language; + if (account.source.privacy != null && account.source.privacy != "") { + string visibility_id = account.source.privacy.down (); + if (account.visibility.has_key (visibility_id)) settings.default_post_visibility = visibility_id; + } + } } catch (Error e) { warning (@"Couldn't activate account $(account.handle):");