Merge pull request #1226 from Bilb/various-closed-group-fixes

pull/1230/head
Audric Ackermann 5 years ago committed by GitHub
commit 3fa54c3ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -630,6 +630,8 @@
groupId,
'group'
);
const oldMembers = convo.get('members');
const oldName = convo.getName();
const ev = {
groupDetails: {
@ -709,7 +711,6 @@
const updateObj = {
id: groupId,
name: groupName,
avatar: nullAvatar,
recipients,
members,
@ -717,6 +718,19 @@
options,
};
if (oldName !== groupName) {
updateObj.name = groupName;
}
const addedMembers = _.difference(updateObj.members, oldMembers);
if (addedMembers.length > 0) {
updateObj.joined = addedMembers;
}
// Check if anyone got kicked:
const removedMembers = _.difference(oldMembers, updateObj.members);
if (removedMembers.length > 0) {
updateObj.kicked = removedMembers;
}
// Send own sender keys and group secret key
if (isMediumGroup) {
const { chainKey, keyIdx } = await window.SenderKeyAPI.getSenderKeys(

@ -1891,7 +1891,7 @@
// if we do set an identifier here, be sure to not sync the message two times in msg.handleMessageSentSuccess()
timestamp: now,
groupId: id,
name,
name: name || this.getName(),
avatar,
members,
admins: this.get('groupAdmins'),

@ -1,33 +0,0 @@
/* global Backbone, Whisper */
// eslint-disable-next-line func-names
(function() {
'use strict';
window.Whisper = window.Whisper || {};
// TODO: remove this as unused?
Whisper.GroupUpdateView = Backbone.View.extend({
tagName: 'div',
className: 'group-update',
render() {
// TODO l10n
if (this.model.left) {
this.$el.text(`${this.model.left} left the group`);
return this;
}
const messages = ['Updated the group.'];
if (this.model.name) {
messages.push(`Group name has been set to '${this.model.name}'.`);
}
if (this.model.joined) {
messages.push(`${this.model.joined.join(', ')} joined the group`);
}
this.$el.text(messages.join(' '));
return this;
},
});
})();

@ -685,7 +685,7 @@ label {
padding-left: 10px;
}
.create-group-dialog .session-modal__body {
.session-modal__body {
display: flex;
flex-direction: column;

@ -1,7 +1,7 @@
import React from 'react';
import { SessionModal } from '../session/SessionModal';
import { SessionButton } from '../session/SessionButton';
import { SessionButton, SessionButtonColor } from '../session/SessionButton';
import {
ContactType,
SessionMemberListItem,
@ -87,6 +87,7 @@ export class InviteContactsDialog extends React.Component<Props, State> {
text={okText}
disabled={!hasContacts}
onClick={this.onClickOK}
buttonColor={SessionButtonColor.Green}
/>
</div>
</SessionModal>

@ -3,7 +3,7 @@ import classNames from 'classnames';
import { Contact } from './MemberList';
import { SessionModal } from '../session/SessionModal';
import { SessionButton } from '../session/SessionButton';
import { SessionButton, SessionButtonColor } from '../session/SessionButton';
import {
ContactType,
SessionMemberListItem,
@ -136,9 +136,12 @@ export class UpdateGroupMembersDialog extends React.Component<Props, State> {
<div className="spacer-lg" />
<div className="session-modal__button-group">
<SessionButton text={okText} onClick={this.onClickOK} />
<SessionButton text={cancelText} onClick={this.closeDialog} />
<SessionButton
text={okText}
onClick={this.onClickOK}
buttonColor={SessionButtonColor.Green}
/>
</div>
</SessionModal>
);

@ -2,7 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import { SessionModal } from '../session/SessionModal';
import { SessionButton } from '../session/SessionButton';
import { SessionButton, SessionButtonColor } from '../session/SessionButton';
import { Avatar } from '../Avatar';
interface Props {
@ -106,9 +106,13 @@ export class UpdateGroupNameDialog extends React.Component<Props, State> {
/>
<div className="session-modal__button-group">
<SessionButton text={okText} onClick={this.onClickOK} />
<SessionButton text={cancelText} onClick={this.closeDialog} />
<SessionButton
text={okText}
onClick={this.onClickOK}
buttonColor={SessionButtonColor.Green}
/>
</div>
</SessionModal>
);

@ -522,6 +522,16 @@ export async function handleMessageJob(
handleSessionReset(conversation, message);
} else if (message.isExpirationTimerUpdate()) {
const { expireTimer } = initialMessage;
const oldValue = conversation.get('expireTimer');
if (expireTimer === oldValue) {
if (confirm) {
confirm();
}
window.console.log(
'Dropping ExpireTimerUpdate message as we already have the same one set.'
);
return;
}
handleExpirationTimerUpdate(conversation, message, source, expireTimer);
} else {
await handleRegularMessage(

Loading…
Cancel
Save