Show notifications when a user's profile name changes
This commit is contained in:
parent
2f015863ca
commit
d75eee015f
44 changed files with 749 additions and 194 deletions
29
ts/util/getStringForProfileChange.ts
Normal file
29
ts/util/getStringForProfileChange.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { LocalizerType } from '../types/Util';
|
||||
import { ConversationType } from '../state/ducks/conversations';
|
||||
|
||||
export type ProfileNameChangeType = {
|
||||
type: 'name';
|
||||
oldName: string;
|
||||
newName: string;
|
||||
};
|
||||
|
||||
export function getStringForProfileChange(
|
||||
change: ProfileNameChangeType,
|
||||
changedContact: ConversationType,
|
||||
i18n: LocalizerType
|
||||
) {
|
||||
if (change.type === 'name') {
|
||||
return changedContact.name
|
||||
? i18n('contactChangedProfileName', {
|
||||
sender: changedContact.title,
|
||||
oldProfile: change.oldName,
|
||||
newProfile: change.newName,
|
||||
})
|
||||
: i18n('changedProfileName', {
|
||||
oldProfile: change.oldName,
|
||||
newProfile: change.newName,
|
||||
});
|
||||
} else {
|
||||
throw new Error('TimelineItem: Unknown type!');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue