feat(secret): store updated account info
no point in keeping the initial display_name and avatar if the user has updated them
This commit is contained in:
parent
bb38f7ff0e
commit
8c908a05a7
|
@ -35,19 +35,23 @@ public class Tooth.SecretAccountStore : AccountStore {
|
||||||
|
|
||||||
secrets.foreach (item => {
|
secrets.foreach (item => {
|
||||||
var account = secret_to_account (item);
|
var account = secret_to_account (item);
|
||||||
if (account != null) {
|
if (account != null && account.id != "") {
|
||||||
new Request.GET (@"/api/v1/accounts/$(account.id)")
|
new Request.GET (@"/api/v1/accounts/$(account.id)")
|
||||||
.with_account (account)
|
.with_account (account)
|
||||||
.then ((sess, msg) => {
|
.then ((sess, msg) => {
|
||||||
var node = network.parse_node (msg);
|
var node = network.parse_node (msg);
|
||||||
var acc = API.Account.from (node);
|
var acc = API.Account.from (node);
|
||||||
|
|
||||||
account.display_name = acc.display_name;
|
if (account.display_name != acc.display_name || account.avatar != acc.avatar) {
|
||||||
account.avatar = acc.avatar;
|
account.display_name = acc.display_name;
|
||||||
})
|
account.avatar = acc.avatar;
|
||||||
.exec ();
|
|
||||||
saved.add (account);
|
account_to_secret (account);
|
||||||
account.added ();
|
}
|
||||||
|
})
|
||||||
|
.exec ();
|
||||||
|
saved.add (account);
|
||||||
|
account.added ();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
changed (saved);
|
changed (saved);
|
||||||
|
|
Loading…
Reference in New Issue