Merge pull request #1093 from Bilb/fix-various-closed-group

Fix various closed group
pull/1105/head
Mikunj Varsani 5 years ago committed by GitHub
commit 1a0b760fa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -210,6 +210,9 @@
},
getLokiNameForNumber(number) {
const conversation = ConversationController.get(number);
if (number === textsecure.storage.user.getNumber()) {
return i18n('you');
}
if (!conversation || !conversation.getLokiProfile()) {
return number;
}
@ -506,6 +509,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, {
@ -514,7 +523,7 @@
color,
avatarPath: contactModel ? contactModel.getAvatarPath() : null,
name: contactModel ? contactModel.getName() : null,
profileName: contactModel ? contactModel.getProfileName() : null,
profileName,
title: contactModel ? contactModel.getTitle() : null,
};
},

@ -164,7 +164,6 @@
Component: window.Signal.Components.UpdateGroupMembersDialog,
props: {
titleText: this.titleText,
groupName: this.groupName,
okText: i18n('ok'),
cancelText: i18n('cancel'),
isPublic: this.isPublic,
@ -180,13 +179,30 @@
this.$el.append(this.dialogView.el);
return this;
},
onSubmit(groupName, newMembers) {
onSubmit(newMembers) {
const ourPK = textsecure.storage.user.getNumber();
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)
);
// would be easer with _.xor but for some reason we do not have it
const xor = notPresentInNew.concat(notPresentInOld);
if (xor.length === 0) {
window.console.log(
'skipping group update: no detected changes in group member list'
);
return;
}
window.doUpdateGroup(
this.groupId,
groupName,
this.groupName,
allMembers,
this.avatarPath
);

@ -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<Props> {
public renderChange(change: Change) {
const { isMe, contacts, type, newName } = change;

@ -11,7 +11,6 @@ import {
interface Props {
titleText: string;
groupName: string;
okText: string;
isPublic: boolean;
cancelText: string;
@ -72,7 +71,7 @@ export class UpdateGroupMembersDialog extends React.Component<Props, State> {
d => d.id
);
this.props.onSubmit(this.props.groupName, members);
this.props.onSubmit(members);
this.closeDialog();
}

Loading…
Cancel
Save