Always show contact name in Safety Number warning

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal
2026-07-20 17:32:43 +00:00
committed by GitHub
co-authored by Scott Nonnenberg
parent 8a8d1aa511
commit 0700ff676f
8 changed files with 15 additions and 41 deletions
+1 -1
View File
@@ -3178,7 +3178,7 @@
},
"icu:safetyNumberChangedGroup": {
"messageformat": "Safety Number with {name} has changed",
"description": "A notification shown in a group conversation when a contact reinstalls, showing the contact name"
"description": "A notification shown in a group and 1:1 conversations when a contact reinstalls, showing the contact name"
},
"icu:ConversationDetails__viewSafetyNumber": {
"messageformat": "View Safety Number",
@@ -17,22 +17,17 @@ const createContact = (props: Partial<ContactType>): ContactType => ({
export default {
title: 'Components/Conversation/SafetyNumberNotification',
argTypes: {
isGroup: { control: { type: 'boolean' } },
},
args: {
i18n,
contact: {} as ContactType,
isGroup: false,
toggleSafetyNumberModal: action('toggleSafetyNumberModal'),
},
} satisfies Meta<Props>;
export function GroupConversation(args: Props): JSX.Element {
export function Default(args: Props): JSX.Element {
return (
<SafetyNumberNotification
{...args}
isGroup
contact={createContact({
title: 'Mr. Fire',
})}
@@ -40,23 +35,10 @@ export function GroupConversation(args: Props): JSX.Element {
);
}
export function DirectConversation(args: Props): JSX.Element {
export function LongName(args: Props): JSX.Element {
return (
<SafetyNumberNotification
{...args}
isGroup
contact={createContact({
title: 'Mr. Fire',
})}
/>
);
}
export function LongNameInGroup(args: Props): JSX.Element {
return (
<SafetyNumberNotification
{...args}
isGroup
contact={createContact({
title: '🐈‍⬛🍕🎂'.repeat(50),
})}
@@ -15,7 +15,6 @@ export type ContactType = {
};
export type PropsData = {
isGroup: boolean;
contact: ContactType;
};
@@ -31,7 +30,6 @@ export type Props = PropsData & PropsHousekeeping & PropsActions;
export function SafetyNumberNotification({
contact,
isGroup,
i18n,
toggleSafetyNumberModal,
}: Props): JSX.Element {
@@ -50,15 +48,11 @@ export function SafetyNumberNotification({
<SystemMessage
icon="safety-number"
contents={
isGroup ? (
<I18n
id="icu:safetyNumberChangedGroup"
components={{ name }}
i18n={i18n}
/>
) : (
<I18n id="icu:safetyNumberChanged" i18n={i18n} />
)
<I18n
id="icu:safetyNumberChangedGroup"
components={{ name }}
i18n={i18n}
/>
}
button={
<Button
@@ -131,7 +131,6 @@ const items: Record<string, TimelineItemType> = {
id: '+1202555000',
title: 'Mr. Fire',
},
isGroup: true,
},
timestamp: Date.now(),
},
+1 -2
View File
@@ -1546,10 +1546,9 @@ function getPropsForSafetyNumberNotification(
);
}
const contact = identifier ? conversationSelector(identifier) : conversation;
const contact = isGroup ? conversationSelector(identifier) : conversation;
return {
isGroup,
contact,
};
}
+1 -1
View File
@@ -147,7 +147,7 @@ describe('messaging/relink', function (this: Mocha.Suite) {
)
.click();
await expectSystemMessages(window, [/Safety Number has changed/]);
await expectSystemMessages(window, [/Safety Number with Alice/]);
}
});
});
@@ -113,7 +113,7 @@ describe('safety number', function (this: Mocha.Suite) {
await changeIdentityKey();
await expectSystemMessages(window, [
/Safety Number has changed/, // Bob's key from storage service
/Safety Number with Alice/, // Alice's key from storage service
]);
debug('Sending message');
@@ -126,8 +126,8 @@ describe('safety number', function (this: Mocha.Suite) {
await dialog.locator(`"${alice.profileName}"`).waitFor();
await expectSystemMessages(window, [
/Safety Number has changed/, // Bob's key from storage service
/Safety Number has changed/, // Fixed Alice's key from backend
/Safety Number with/, // One is a fixed Alice's key from backend
/Safety Number with/, // Other is Bob's key from storage service
]);
debug('Confirming send');
+2 -2
View File
@@ -285,7 +285,7 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
// Two notifications - the safety number change and PhoneNumberDiscovery
await expectSystemMessages(window, [
/.* belongs to ContactA/,
/Safety Number has changed/,
/Safety Number with ContactA/,
]);
}
});
@@ -423,7 +423,7 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
// Three notifications - accepted, the safety number change and PhoneNumberDiscovery
await expectSystemMessages(window, [
/.* belongs to ContactA/,
/Safety Number has changed/,
/Safety Number with ContactA/,
]);
}
});