systemGivenName/systemFamilyName in ContactPill

This commit is contained in:
Fedor Indutny 2022-09-27 16:07:00 -07:00 committed by GitHub
parent 5957c111cf
commit ffac571dd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 3 deletions

View file

@ -87,6 +87,8 @@ message ContactRecord {
optional uint64 mutedUntilTimestamp = 13;
optional bool hideStory = 14;
optional uint64 unregisteredAtTimestamp = 16;
optional string systemGivenName = 17;
optional string systemFamilyName = 18;
}
message GroupV1Record {

View file

@ -819,7 +819,7 @@ export const EditDistributionList = ({
acceptedMessageRequest={contact.acceptedMessageRequest}
avatarPath={contact.avatarPath}
color={contact.color}
firstName={contact.firstName}
firstName={contact.systemGivenName ?? contact.firstName}
i18n={i18n}
id={contact.id}
isMe={contact.isMe}

View file

@ -307,7 +307,7 @@ export const ChooseGroupMembersModal: FunctionComponent<PropsType> = ({
acceptedMessageRequest={contact.acceptedMessageRequest}
avatarPath={contact.avatarPath}
color={contact.color}
firstName={contact.firstName}
firstName={contact.systemGivenName ?? contact.firstName}
i18n={i18n}
isMe={contact.isMe}
id={contact.id}

View file

@ -219,7 +219,7 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
acceptedMessageRequest={contact.acceptedMessageRequest}
avatarPath={contact.avatarPath}
color={contact.color}
firstName={contact.firstName}
firstName={contact.systemGivenName ?? contact.firstName}
i18n={i18n}
id={contact.id}
isMe={contact.isMe}

2
ts/model-types.d.ts vendored
View file

@ -314,6 +314,8 @@ export type ConversationAttributesType = {
isArchived?: boolean;
lastMessage?: string | null;
name?: string;
systemGivenName?: string;
systemFamilyName?: string;
needsStorageServiceSync?: boolean;
needsVerification?: boolean;
profileSharing?: boolean;

View file

@ -1904,6 +1904,8 @@ export class ConversationModel extends window.Backbone
muteExpiresAt: this.get('muteExpiresAt'),
dontNotifyForMentionsIfMuted: this.get('dontNotifyForMentionsIfMuted'),
name: this.get('name'),
systemGivenName: this.get('systemGivenName'),
systemFamilyName: this.get('systemFamilyName'),
phoneNumber: this.getNumber(),
profileName: this.getProfileName(),
profileSharing: this.get('profileSharing'),
@ -4971,6 +4973,7 @@ export class ConversationModel extends window.Backbone
const username = this.get('username');
return (
(isShort ? this.get('systemGivenName') : undefined) ||
this.get('name') ||
(isShort ? this.get('profileName') : undefined) ||
this.getProfileName() ||

View file

@ -165,6 +165,14 @@ export async function toContactRecord(
if (profileFamilyName) {
contactRecord.familyName = profileFamilyName;
}
const systemGivenName = conversation.get('systemGivenName');
if (systemGivenName) {
contactRecord.systemGivenName = systemGivenName;
}
const systemFamilyName = conversation.get('systemFamilyName');
if (systemFamilyName) {
contactRecord.systemFamilyName = systemFamilyName;
}
contactRecord.blocked = conversation.isBlocked();
contactRecord.whitelisted = Boolean(conversation.get('profileSharing'));
contactRecord.archived = Boolean(conversation.get('isArchived'));
@ -934,6 +942,10 @@ export async function mergeContactRecord(
details.push('updated profile name');
}
}
conversation.set({
systemGivenName: dropNull(contactRecord.systemGivenName),
systemFamilyName: dropNull(contactRecord.systemFamilyName),
});
if (contactRecord.identityKey) {
const verified = await conversation.safeGetVerified();

View file

@ -114,6 +114,8 @@ export type ConversationType = {
pni?: UUIDStringType;
e164?: string;
name?: string;
systemGivenName?: string;
systemFamilyName?: string;
familyName?: string;
firstName?: string;
profileName?: string;