Process username changes in storage service
This commit is contained in:
parent
71c97e9580
commit
1381e8df5d
8 changed files with 252 additions and 53 deletions
|
@ -33,6 +33,7 @@ import {
|
|||
getSafeLongFromTimestamp,
|
||||
getTimestampFromLong,
|
||||
} from '../util/timestampLongUtils';
|
||||
import { canHaveUsername } from '../util/getTitle';
|
||||
import {
|
||||
get as getUniversalExpireTimer,
|
||||
set as setUniversalExpireTimer,
|
||||
|
@ -156,6 +157,11 @@ export async function toContactRecord(
|
|||
if (e164) {
|
||||
contactRecord.serviceE164 = e164;
|
||||
}
|
||||
const username = conversation.get('username');
|
||||
const ourID = window.ConversationController.getOurConversationId();
|
||||
if (username && canHaveUsername(conversation.attributes, ourID)) {
|
||||
contactRecord.username = username;
|
||||
}
|
||||
const pni = conversation.get('pni');
|
||||
if (pni && RemoteConfig.isEnabled('desktop.pnp')) {
|
||||
contactRecord.pni = pni;
|
||||
|
@ -978,6 +984,10 @@ export async function mergeContactRecord(
|
|||
};
|
||||
}
|
||||
|
||||
await conversation.updateUsername(dropNull(contactRecord.username), {
|
||||
shouldSave: false,
|
||||
});
|
||||
|
||||
let needsProfileFetch = false;
|
||||
if (contactRecord.profileKey && contactRecord.profileKey.length > 0) {
|
||||
needsProfileFetch = await conversation.setProfileKey(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue