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

@ -36,6 +36,10 @@ import {
PropsData as GroupNotificationProps,
} from './GroupNotification';
import { ResetSessionNotification } from './ResetSessionNotification';
import {
ProfileChangeNotification,
PropsType as ProfileChangeNotificationPropsType,
} from './ProfileChangeNotification';
type CallHistoryType = {
type: 'callHistory';
@ -73,16 +77,22 @@ type ResetSessionNotificationType = {
type: 'resetSessionNotification';
data: null;
};
type ProfileChangeNotificationType = {
type: 'profileChange';
data: ProfileChangeNotificationPropsType;
};
export type TimelineItemType =
| CallHistoryType
| GroupNotificationType
| LinkNotificationType
| MessageType
| ProfileChangeNotificationType
| ResetSessionNotificationType
| SafetyNumberNotificationType
| TimerNotificationType
| UnsupportedMessageType
| VerificationNotificationType
| GroupNotificationType;
| VerificationNotificationType;
type PropsLocalType = {
conversationId: string;
@ -159,6 +169,10 @@ export class TimelineItem extends React.PureComponent<PropsType> {
notification = (
<ResetSessionNotification {...this.props} {...item.data} i18n={i18n} />
);
} else if (item.type === 'profileChange') {
notification = (
<ProfileChangeNotification {...this.props} {...item.data} i18n={i18n} />
);
} else {
throw new Error('TimelineItem: Unknown type!');
}