Show notifications when a user's profile name changes

This commit is contained in:
Scott Nonnenberg 2020-07-29 16:20:05 -07:00
parent 2f015863ca
commit d75eee015f
44 changed files with 749 additions and 194 deletions

View 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!');
}
}