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 uint64 mutedUntilTimestamp = 13;
optional bool hideStory = 14; optional bool hideStory = 14;
optional uint64 unregisteredAtTimestamp = 16; optional uint64 unregisteredAtTimestamp = 16;
optional string systemGivenName = 17;
optional string systemFamilyName = 18;
} }
message GroupV1Record { message GroupV1Record {

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

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