Skip to content

Commit

Permalink
feat(store): sync post privacy with instance (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr authored Mar 8, 2024
1 parent 7f437a1 commit 75db6a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/API/Account/Source.vala
Original file line number Diff line number Diff line change
@@ -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<API.AccountField>? fields { get; set; default=null; }

public override Type deserialize_array_type (string prop) {
Expand Down
9 changes: 7 additions & 2 deletions src/Services/Accounts/AccountStore.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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):");
Expand Down

0 comments on commit 75db6a7

Please sign in to comment.