Usernames: Fetch own username from /whoami not /profile
This commit is contained in:
parent
70ae5bb613
commit
a023fc1bb0
9 changed files with 43 additions and 26 deletions
|
@ -174,13 +174,6 @@ export async function getProfile(
|
|||
});
|
||||
}
|
||||
|
||||
const { username } = profile;
|
||||
if (username) {
|
||||
c.set({ username });
|
||||
} else {
|
||||
c.unset('username');
|
||||
}
|
||||
|
||||
if (profile.about) {
|
||||
const key = c.get('profileKey');
|
||||
if (key) {
|
||||
|
|
16
ts/util/updateOurUsername.ts
Normal file
16
ts/util/updateOurUsername.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export async function updateOurUsername(): Promise<void> {
|
||||
if (!window.textsecure.messaging) {
|
||||
throw new Error(
|
||||
'updateOurUsername: window.textsecure.messaging not available'
|
||||
);
|
||||
}
|
||||
|
||||
const me = window.ConversationController.getOurConversationOrThrow();
|
||||
const { username } = await window.textsecure.messaging.whoami();
|
||||
|
||||
me.set({ username });
|
||||
window.Signal.Data.updateConversation(me.attributes);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue