mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-26 05:08:06 +00:00
Usernames: Fetch own username from /whoami not /profile
This commit is contained in:
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);
|
||||
}
|
||||
Reference in New Issue
Block a user