diff --git a/js/models/messages.js b/js/models/messages.js index e6dc4f074..ac7beb0b5 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -205,6 +205,9 @@ }, getLokiNameForNumber(number) { const conversation = ConversationController.get(number); + if (number === textsecure.storage.user.getNumber()) { + return i18n('you'); + } if (!conversation || !conversation.getLokiProfile()) { return number; } @@ -501,6 +504,12 @@ const contactModel = this.findContact(phoneNumber); const color = contactModel ? contactModel.getColor() : null; + let profileName; + if (phoneNumber === window.storage.get('primaryDevicePubKey')) { + profileName = i18n('you'); + } else { + profileName = contactModel ? contactModel.getProfileName() : null; + } return { phoneNumber: format(phoneNumber, { @@ -509,7 +518,7 @@ color, avatarPath: contactModel ? contactModel.getAvatarPath() : null, name: contactModel ? contactModel.getName() : null, - profileName: contactModel ? contactModel.getProfileName() : null, + profileName, title: contactModel ? contactModel.getTitle() : null, }; }, diff --git a/js/views/create_group_dialog_view.js b/js/views/create_group_dialog_view.js index 96c0f8e54..b2f04539f 100644 --- a/js/views/create_group_dialog_view.js +++ b/js/views/create_group_dialog_view.js @@ -184,12 +184,18 @@ const allMembers = window.Lodash.concat(newMembers, [ourPK]); // We need to NOT trigger an group update if the list of member is the same. - const notPresentInOld = allMembers.filter(m => !this.existingMembers.includes(m)); - const notPresentInNew = this.existingMembers.filter(m => !allMembers.includes(m)); + const notPresentInOld = allMembers.filter( + m => !this.existingMembers.includes(m) + ); + const notPresentInNew = this.existingMembers.filter( + m => !allMembers.includes(m) + ); // would be easer with _.xor but for some reason we do not have it - const xor = notPresentInNew.concat(notPresentInOld) + const xor = notPresentInNew.concat(notPresentInOld); if (xor.length === 0) { - window.console.log('skipping group update: no detected changes in group member list'); + window.console.log( + 'skipping group update: no detected changes in group member list' + ); return; } diff --git a/ts/components/conversation/GroupNotification.tsx b/ts/components/conversation/GroupNotification.tsx index b1484bbb4..0da0a50b4 100644 --- a/ts/components/conversation/GroupNotification.tsx +++ b/ts/components/conversation/GroupNotification.tsx @@ -1,5 +1,4 @@ import React from 'react'; -// import classNames from 'classnames'; import { compact, flatten } from 'lodash'; import { Intl } from '../Intl'; @@ -25,6 +24,8 @@ interface Props { i18n: LocalizerType; } +// This class is used to display group updates in the conversation view. +// This is a not a "notification" as the name suggests, but a message inside the conversation export class GroupNotification extends React.Component { public renderChange(change: Change) { const { isMe, contacts, type, newName } = change;