remove updateTextInputState not needed and add left to menu tests

This commit is contained in:
Audric Ackermann 2021-01-13 15:28:20 +11:00
parent b15984aa08
commit 6856c0e748
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4
31 changed files with 93 additions and 175 deletions

View File

@ -1333,9 +1333,6 @@
"deviceUnpaired": {
"message": "Ihr Gerät wurde erfolgreich getrennt."
},
"sendMessageLeftGroup": {
"message": "Du hast die Gruppe verlassen"
},
"moreInformation": {
"message": "Mehr Informationen"
},

View File

@ -959,10 +959,6 @@
"message": "Message",
"description": "Placeholder text in the message entry field"
},
"sendMessageLeftGroup": {
"message": "You have left the group.",
"androidKey": "MessageRecord_left_group"
},
"sendMessageBlockedUser": {
"message": "You have blocked this contact"
},

View File

@ -1207,9 +1207,6 @@
"deviceUnpaired": {
"message": "Tu dispositivo se ha desvinculado correctamente"
},
"sendMessageLeftGroup": {
"message": "Has abandonado el grupo."
},
"moreInformation": {
"message": "Más detalles"
},

View File

@ -1207,9 +1207,6 @@
"deviceUnpaired": {
"message": "Votre appareil a été déconnecté avec succès"
},
"sendMessageLeftGroup": {
"message": "Vous avez quitté le groupe"
},
"moreInformation": {
"message": "Plus dinformations"
},
@ -1768,7 +1765,6 @@
"enterOptionalPassword": {
"message": "Entrer un mot de passe (optionel)"
},
"devicePairingHeaderReassure": {
"message": "Linking may take up to one minute to register on your primary device. Please be patient."
},
@ -1820,4 +1816,4 @@
"description": {
"message": "Description"
}
}
}

View File

@ -1204,9 +1204,6 @@
"deviceUnpaired": {
"message": "Sukses memutus perangkat"
},
"sendMessageLeftGroup": {
"message": "Anda telah keluar dari grup."
},
"moreInformation": {
"message": "Informasi lebih lanjut"
},

View File

@ -1207,9 +1207,6 @@
"deviceUnpaired": {
"message": "Il dispositivo è stato scollegato correttamente"
},
"sendMessageLeftGroup": {
"message": "Hai lasciato il gruppo."
},
"moreInformation": {
"message": "Maggiori informazioni"
},

View File

@ -1207,9 +1207,6 @@
"deviceUnpaired": {
"message": "デバイスは正常にリンク解除されました"
},
"sendMessageLeftGroup": {
"message": "グループを抜けました"
},
"moreInformation": {
"message": "詳細"
},

View File

@ -1207,9 +1207,6 @@
"deviceUnpaired": {
"message": "Twoje urządzenie zostało rozłączone pomyślnie"
},
"sendMessageLeftGroup": {
"message": "Opuściłeś(aś) grupę."
},
"moreInformation": {
"message": "Więcej informacji"
},

View File

@ -1207,9 +1207,6 @@
"deviceUnpaired": {
"message": "O seu dispositivo foi dessincronizado com sucesso"
},
"sendMessageLeftGroup": {
"message": "Você saiu do grupo."
},
"moreInformation": {
"message": "Mais informações"
},

View File

@ -1207,9 +1207,6 @@
"deviceUnpaired": {
"message": "Ваше устройство успешно отвязано"
},
"sendMessageLeftGroup": {
"message": "Вы покинули группу."
},
"moreInformation": {
"message": "Больше информации"
},

View File

@ -1192,9 +1192,6 @@
"deviceUnpaired": {
"message": "Thiết bị của bạn đã được hủy liên kết thành công"
},
"sendMessageLeftGroup": {
"message": "Bạn đã rời nhóm."
},
"resend": {
"message": "Gửi lại"
},

View File

@ -51,7 +51,6 @@ export interface ConversationModel
getRecipients: () => Array<string>;
getTitle: () => string;
onReadMessage: (message: MessageModel) => void;
updateTextInputState: () => void;
getName: () => string;
addMessage: (attributes: Partial<MessageAttributes>) => Promise<MessageModel>;
isMediumGroup: () => boolean;

View File

@ -57,6 +57,7 @@
groupAdmins: [],
isKickedFromGroup: false,
profileSharing: false,
left: false,
};
},
@ -214,9 +215,7 @@
? BlockedNumberController.block(this.id)
: BlockedNumberController.blockGroup(this.id);
await promise;
this.trigger('change', this);
this.messageCollection.forEach(m => m.trigger('change'));
this.updateTextInputState();
this.commit();
await textsecure.messaging.sendBlockedListSyncMessage();
},
async unblock() {
@ -227,14 +226,11 @@
? BlockedNumberController.unblock(this.id)
: BlockedNumberController.unblockGroup(this.id);
await promise;
this.trigger('change', this);
this.messageCollection.forEach(m => m.trigger('change'));
this.updateTextInputState();
this.commit();
await textsecure.messaging.sendBlockedListSyncMessage();
},
async bumpTyping() {
if (this.isPublic()) {
window.log.debug('public conversation... No need to bumpTyping');
if (this.isPublic() || this.isMediumGroup()) {
return;
}
// We don't send typing messages if the setting is disabled or we do not have a session
@ -308,49 +304,37 @@
},
sendTypingMessage(isTyping) {
// Loki - Temporarily disable typing messages for groups
if (!this.isPrivate()) {
return;
}
const groupId = !this.isPrivate() ? this.id : null;
const recipientId = this.isPrivate() ? this.id : null;
const recipientId = this.id;
// We don't want to send typing messages to our other devices, but we will
// in the group case.
const primaryDevicePubkey = window.storage.get('primaryDevicePubKey');
if (recipientId && primaryDevicePubkey === recipientId) {
return;
if (!recipientId) {
throw new Error('Need to provide either recipientId');
}
if (!recipientId && !groupId) {
throw new Error('Need to provide either recipientId or groupId!');
const primaryDevicePubkey = window.storage.get('primaryDevicePubKey');
if (recipientId && primaryDevicePubkey === recipientId) {
// note to self
return;
}
const typingParams = {
timestamp: Date.now(),
isTyping,
typingTimestamp: Date.now(),
groupId, // might be null
};
const typingMessage = new libsession.Messages.Outgoing.TypingMessage(
typingParams
);
// send the message to a single recipient if this is a session chat
if (this.isPrivate()) {
const device = new libsession.Types.PubKey(recipientId);
libsession
.getMessageQueue()
.sendUsingMultiDevice(device, typingMessage)
.catch(log.error);
} else {
// the recipients on the case of a group are found by the messageQueue using message.groupId
libsession
.getMessageQueue()
.sendToGroup(typingMessage)
.catch(log.error);
}
const device = new libsession.Types.PubKey(recipientId);
libsession
.getMessageQueue()
.sendUsingMultiDevice(device, typingMessage)
.catch(log.error);
},
async cleanup() {
@ -460,7 +444,7 @@
messageModel: model,
});
this.trigger('change', this);
this.commit();
},
addSingleMessage(message, setToExpire = true) {
const model = this.messageCollection.add(message, { merge: true });
@ -508,7 +492,7 @@
},
hasNickname: !!this.getNickname(),
isKickedFromGroup: !!this.get('isKickedFromGroup'),
leftGroup: !!this.get('left'),
left: !!this.get('left'),
onClick: () => this.trigger('select', this),
onBlockContact: () => this.block(),
@ -560,8 +544,6 @@
}
})
);
this.onMemberVerifiedChange();
},
setVerifiedDefault(options) {
const { DEFAULT } = this.verifiedEnum;
@ -672,36 +654,6 @@
// Something funky has happened
return this;
},
async updateTextInputState() {
if (this.isRss()) {
// or if we're an rss conversation, disable it
this.trigger('disable:input', true);
return;
}
if (this.isSecondaryDevice()) {
// Or if we're a secondary device, update the primary device text input
const primaryConversation = await this.getPrimaryConversation();
primaryConversation.updateTextInputState();
return;
}
if (this.get('isKickedFromGroup')) {
this.trigger('disable:input', true);
return;
}
if (!this.isPrivate() && this.get('left')) {
this.trigger('disable:input', true);
this.trigger('change:placeholder', 'left-group');
return;
}
if (this.isBlocked()) {
this.trigger('disable:input', true);
this.trigger('change:placeholder', 'blocked-user');
return;
}
// otherwise, enable the input and set default placeholder
this.trigger('disable:input', false);
this.trigger('change:placeholder', 'chat');
},
isSecondaryDevice() {
return !!this.get('secondaryStatus');
},
@ -819,12 +771,6 @@
);
});
},
onMemberVerifiedChange() {
// If the verified state of a member changes, our aggregate state changes.
// We trigger both events to replicate the behavior of Backbone.Model.set()
this.trigger('change:verified', this);
this.trigger('change', this);
},
toggleVerified() {
if (this.isVerified()) {
return this.setVerifiedDefault();
@ -1650,8 +1596,6 @@
'Legacy group are not supported anymore. You need to create this group again.'
);
}
this.updateTextInputState();
},
async markRead(newestUnreadDate, providedOptions) {
@ -2039,14 +1983,6 @@
);
return Promise.all(promises).then(contacts => {
_.forEach(contacts, contact => {
this.listenTo(
contact,
'change:verified',
this.onMemberVerifiedChange
);
});
this.contactCollection.reset(contacts);
});
},
@ -2401,14 +2337,14 @@
if (!record) {
// User was not previously typing before. State change!
this.trigger('typing-update');
this.trigger('change', this);
this.commit();
}
} else {
delete this.contactTypingTimers[identifier];
if (record) {
// User was previously typing, and is no longer. State change!
this.trigger('typing-update');
this.trigger('change', this);
this.commit();
}
}
},
@ -2423,7 +2359,7 @@
// User was previously typing, but timed out or we received message. State change!
this.trigger('typing-update');
this.trigger('change', this);
this.commit();
}
},
});

View File

@ -235,9 +235,9 @@ async function _finishJob(message, id) {
if (fromConversation && message !== fromConversation) {
fromConversation.set(message.attributes);
fromConversation.trigger('change', fromConversation);
fromConversation.commit();
} else {
message.trigger('change', message);
message.commit();
}
}
}

View File

@ -207,8 +207,7 @@
window.confirmationDialog({
title,
message,
resolve: () =>
window.getConversationController().deleteContact(groupConvo.id),
resolve: () => groupConvo.leaveGroup(),
theme: this.getThemeObject(),
});
} else {

View File

@ -37,12 +37,9 @@
},
initialize(options) {
this.listenTo(this.model, 'destroy', this.stopListening);
this.listenTo(this.model, 'change:verified', this.onVerifiedChange);
this.listenTo(this.model, 'newmessage', this.addMessage);
this.listenTo(this.model, 'opened', this.onOpened);
this.listenTo(this.model, 'prune', this.onPrune);
this.listenTo(this.model, 'disable:input', this.onDisableInput);
this.listenTo(this.model, 'change:placeholder', this.onChangePlaceholder);
this.listenTo(this.model, 'unload', () => this.unload('model trigger'));
this.listenTo(this.model, 'typing-update', this.renderTypingBubble);
this.listenTo(
@ -98,8 +95,6 @@
this.render();
this.model.updateTextInputState();
this.window = options.window;
Whisper.events.on('mediaPermissionsChanged', () =>
@ -127,8 +122,6 @@
this.$('.send-message').focus(this.focusBottomBar.bind(this));
this.$('.send-message').blur(this.unfocusBottomBar.bind(this));
this.model.updateTextInputState();
this.selectMember = this.selectMember.bind(this);
const updateMemberList = async () => {

View File

@ -54,6 +54,7 @@ export type ConversationListItemProps = {
isSecondary?: boolean;
isGroupInvitation?: boolean;
isKickedFromGroup?: boolean;
left?: boolean;
memberAvatars?: Array<ConversationAvatar>; // this is added by usingClosedConversationDetails
};

View File

@ -62,6 +62,7 @@ interface Props {
isBlocked: boolean;
isKickedFromGroup: boolean;
left: boolean;
selectionMode: boolean; // is the UI on the message selection mode or not
onInviteContacts: () => void;

View File

@ -63,7 +63,7 @@ interface Props {
isBlocked: boolean;
isPrivate: boolean;
isKickedFromGroup: boolean;
leftGroup: boolean;
left: boolean;
conversationKey: string;
isPublic: boolean;
@ -259,9 +259,9 @@ export class SessionCompositionBox extends React.Component<Props, State> {
}
private isTypingEnabled(): boolean {
const { isBlocked, isKickedFromGroup, leftGroup, isPrivate } = this.props;
const { isBlocked, isKickedFromGroup, left, isPrivate } = this.props;
return !(isBlocked || isKickedFromGroup || leftGroup);
return !(isBlocked || isKickedFromGroup || left);
}
private renderCompositionView() {
@ -347,10 +347,10 @@ export class SessionCompositionBox extends React.Component<Props, State> {
private renderTextArea() {
const { i18n } = window;
const { message } = this.state;
const { isKickedFromGroup, leftGroup, isPrivate, isBlocked } = this.props;
const { isKickedFromGroup, left, isPrivate, isBlocked } = this.props;
const messagePlaceHolder = isKickedFromGroup
? i18n('youGotKickedFromGroup')
: leftGroup
: left
? i18n('youLeftTheGroup')
: isBlocked && isPrivate
? i18n('unblockToSend')
@ -784,7 +784,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
this.parseEmojis(this.state.message)
);
const { isBlocked, isPrivate, leftGroup, isKickedFromGroup } = this.props;
const { isBlocked, isPrivate, left, isKickedFromGroup } = this.props;
// deny sending of message if our app version is expired
if (window.extension.expiredStatus() === true) {
@ -827,7 +827,7 @@ export class SessionCompositionBox extends React.Component<Props, State> {
}
}
if (!isPrivate && leftGroup) {
if (!isPrivate && left) {
ToastUtils.pushYouLeftTheGroup();
return;
}

View File

@ -346,7 +346,7 @@ export class SessionConversation extends React.Component<Props, State> {
// tslint:disable-next-line: use-simple-attributes
<SessionCompositionBox
isBlocked={conversation.isBlocked}
leftGroup={conversation.leftGroup}
left={conversation.left}
isKickedFromGroup={conversation.isKickedFromGroup}
isPrivate={conversation.type === 'direct'}
isPublic={conversation.isPublic || false}
@ -450,6 +450,7 @@ export class SessionConversation extends React.Component<Props, State> {
members,
subscriberCount: conversation.get('subscriberCount'),
isKickedFromGroup: conversation.get('isKickedFromGroup'),
left: conversation.get('left'),
expirationSettingName,
showBackButton: Boolean(infoViewState || messageDetailShowProps),
timerOptions: window.Whisper.ExpirationTimerOptions.map((item: any) => ({
@ -561,10 +562,10 @@ export class SessionConversation extends React.Component<Props, State> {
memberCount: members.length,
phoneNumber: conversation.getNumber(),
profileName: conversation.getProfileName(),
description: '', // TODO VINCE: ENSURE DESCRIPTION IS SET
avatarPath: conversation.getAvatarPath(),
amMod: conversation.isModerator(),
isKickedFromGroup: conversation.attributes.isKickedFromGroup,
isKickedFromGroup: conversation.get('isKickedFromGroup'),
left: conversation.get('left'),
isGroup: !conversation.isPrivate(),
isPublic: conversation.isPublic(),
isAdmin,

View File

@ -31,6 +31,7 @@ interface Props {
isAdmin: boolean;
amMod: boolean;
isKickedFromGroup: boolean;
left: boolean;
isBlocked: boolean;
isGroup: boolean;
memberAvatars?: Array<ConversationAvatar>; // this is added by usingClosedConversationDetails
@ -235,6 +236,7 @@ class SessionRightPanel extends React.Component<Props, State> {
this.props.onShowLightBox(options);
}
// tslint:disable-next-line: cyclomatic-complexity
public render() {
const {
memberCount,
@ -242,6 +244,7 @@ class SessionRightPanel extends React.Component<Props, State> {
timerOptions,
onLeaveGroup,
isKickedFromGroup,
left,
isPublic,
isAdmin,
amMod,
@ -250,12 +253,15 @@ class SessionRightPanel extends React.Component<Props, State> {
} = this.props;
const { documents, media, onItemClick } = this.state;
const showMemberCount = !!(memberCount && memberCount > 0);
const hasDisappearingMessages =
!isPublic && !isKickedFromGroup && !isBlocked;
const commonNoShow = isKickedFromGroup || left || isBlocked;
const hasDisappearingMessages = !isPublic && !commonNoShow;
const leaveGroupString = isPublic
? window.i18n('leaveGroup')
: isKickedFromGroup
? window.i18n('youGotKickedFromGroup')
: left
? window.i18n('youLeftTheGroup')
: window.i18n('leaveGroup');
const disappearingMessagesOptions = timerOptions.map(option => {
@ -268,11 +274,10 @@ class SessionRightPanel extends React.Component<Props, State> {
});
const showUpdateGroupNameButton =
isPublic && !isKickedFromGroup
? amMod && !isBlocked
: isAdmin && !isBlocked && !isKickedFromGroup;
const showUpdateGroupMembersButton =
!isPublic && !isKickedFromGroup && !isBlocked && isAdmin;
isPublic && !commonNoShow
? amMod && !commonNoShow
: isAdmin && !commonNoShow;
const showUpdateGroupMembersButton = !isPublic && !commonNoShow && isAdmin;
return (
<div className="group-settings">
@ -326,7 +331,7 @@ class SessionRightPanel extends React.Component<Props, State> {
<SessionButton
text={leaveGroupString}
buttonColor={SessionButtonColor.Danger}
disabled={isKickedFromGroup}
disabled={isKickedFromGroup || left}
buttonType={SessionButtonType.SquareOutline}
onClick={onLeaveGroup}
/>
@ -349,10 +354,11 @@ class SessionRightPanel extends React.Component<Props, State> {
name,
profileName,
phoneNumber,
left,
} = this.props;
const showInviteContacts =
(isPublic || isAdmin) && !isKickedFromGroup && !isBlocked;
(isPublic || isAdmin) && !isKickedFromGroup && !isBlocked && !left;
const userName = name || profileName || phoneNumber;
return (

View File

@ -23,6 +23,7 @@ export type PropsConversationHeaderMenu = {
isRss?: boolean;
isClosable?: boolean;
isKickedFromGroup?: boolean;
left?: boolean;
isGroup: boolean;
amMod: boolean;
timerOptions: Array<TimerOption>;
@ -57,6 +58,7 @@ export const ConversationHeaderMenu = (props: PropsConversationHeaderMenu) => {
timerOptions,
isBlocked,
isPrivate,
left,
onDeleteMessages,
onDeleteContact,
@ -79,6 +81,7 @@ export const ConversationHeaderMenu = (props: PropsConversationHeaderMenu) => {
isPublic,
isRss,
isKickedFromGroup,
left,
isBlocked,
timerOptions,
onSetDisappearingMessages,
@ -126,11 +129,13 @@ export const ConversationHeaderMenu = (props: PropsConversationHeaderMenu) => {
{getUpdateGroupNameMenuItem(
amMod,
isKickedFromGroup,
left,
onUpdateGroupName,
window.i18n
)}
{getLeaveGroupMenuItem(
isKickedFromGroup,
left,
isGroup,
isPublic,
isRss,

View File

@ -21,6 +21,7 @@ export type PropsContextConversationItem = {
isBlocked?: boolean;
hasNickname?: boolean;
isKickedFromGroup?: boolean;
left?: boolean;
onDeleteMessages?: () => void;
onDeleteContact?: () => void;
@ -44,6 +45,7 @@ export const ConversationListItemContextMenu = (
isPublic,
hasNickname,
type,
left,
isKickedFromGroup,
onDeleteContact,
onDeleteMessages,
@ -103,6 +105,7 @@ export const ConversationListItemContextMenu = (
)}
{getLeaveGroupMenuItem(
isKickedFromGroup,
left,
type === 'group',
isPublic,
isRss,

View File

@ -7,9 +7,10 @@ function showTimerOptions(
isPublic: boolean,
isRss: boolean,
isKickedFromGroup: boolean,
left: boolean,
isBlocked: boolean
): boolean {
return !isPublic && !isRss && !isKickedFromGroup && !isBlocked;
return !isPublic && !isRss && !left && !isKickedFromGroup && !isBlocked;
}
function showMemberMenu(
@ -89,18 +90,20 @@ function showRemoveModerators(
function showUpdateGroupName(
amMod: boolean,
isKickedFromGroup: boolean
isKickedFromGroup: boolean,
left: boolean
): boolean {
return !isKickedFromGroup && amMod;
return !isKickedFromGroup && !left && amMod;
}
function showLeaveGroup(
isKickedFromGroup: boolean,
left: boolean,
isGroup: boolean,
isPublic: boolean,
isRss: boolean
): boolean {
return !isKickedFromGroup && isGroup && !isPublic && !isRss;
return !isKickedFromGroup && !left && isGroup && !isPublic && !isRss;
}
function showInviteContact(isGroup: boolean, isPublic: boolean): boolean {
@ -149,6 +152,7 @@ export function getDeleteContactMenuItem(
export function getLeaveGroupMenuItem(
isKickedFromGroup: boolean | undefined,
left: boolean | undefined,
isGroup: boolean | undefined,
isPublic: boolean | undefined,
isRss: boolean | undefined,
@ -158,6 +162,7 @@ export function getLeaveGroupMenuItem(
if (
showLeaveGroup(
Boolean(isKickedFromGroup),
Boolean(left),
Boolean(isGroup),
Boolean(isPublic),
Boolean(isRss)
@ -171,10 +176,17 @@ export function getLeaveGroupMenuItem(
export function getUpdateGroupNameMenuItem(
amMod: boolean | undefined,
isKickedFromGroup: boolean | undefined,
left: boolean | undefined,
action: any,
i18n: LocalizerType
): JSX.Element | null {
if (showUpdateGroupName(Boolean(amMod), Boolean(isKickedFromGroup))) {
if (
showUpdateGroupName(
Boolean(amMod),
Boolean(isKickedFromGroup),
Boolean(left)
)
) {
return <Item onClick={action}>{i18n('editGroup')}</Item>;
}
return null;
@ -222,6 +234,7 @@ export function getDisappearingMenuItem(
isPublic: boolean | undefined,
isRss: boolean | undefined,
isKickedFromGroup: boolean | undefined,
left: boolean | undefined,
isBlocked: boolean | undefined,
timerOptions: Array<TimerOption>,
action: any,
@ -232,6 +245,7 @@ export function getDisappearingMenuItem(
Boolean(isPublic),
Boolean(isRss),
Boolean(isKickedFromGroup),
Boolean(left),
Boolean(isBlocked)
)
) {

View File

@ -188,14 +188,16 @@ async function handleNewClosedGroupV2(
const groupExists = !!maybeConvo;
if (groupExists) {
if (maybeConvo && maybeConvo.get('isKickedFromGroup')) {
if (
maybeConvo &&
(maybeConvo.get('isKickedFromGroup') || maybeConvo.get('left'))
) {
// TODO: indicate that we've been re-invited
// to the group if that is the case
// Enable typing:
maybeConvo.set('isKickedFromGroup', false);
maybeConvo.set('left', false);
maybeConvo.updateTextInputState();
} else {
log.warn(
'Ignoring a closed group v2 message of type NEW: the conversation already exists'
@ -305,7 +307,6 @@ async function handleUpdateClosedGroupV2(
);
convo.set('isKickedFromGroup', true);
// Disable typing:
convo.updateTextInputState();
window.SwarmPolling.removePubkey(groupPublicKey);
} else {
if (convo.get('isKickedFromGroup')) {
@ -314,7 +315,6 @@ async function handleUpdateClosedGroupV2(
convo.set('left', false);
// Subscribe to this group id
window.SwarmPolling.addGroupId(new PubKey(groupPublicKey));
convo.updateTextInputState();
}
}

View File

@ -179,7 +179,7 @@ async function handleAuthorisationForSelf(
primaryDevicePubKey,
'private'
);
primaryConversation.trigger('change');
await primaryConversation.commit();
Whisper.events.trigger('secondaryDeviceRegistration');
// Update profile
if (dataMessage) {
@ -430,7 +430,6 @@ async function onContactReceived(details: any) {
if (conversation.isPrivate()) {
await BlockedNumberController.setBlocked(conversation.id, isBlocked);
}
conversation.updateTextInputState();
await conversation.commit();
} catch (error) {

View File

@ -420,9 +420,6 @@ async function handleRegularMessage(
conversation.set({ active_at: now });
// Re-enable typing if re-joined the group
conversation.updateTextInputState();
// Handle expireTimer found directly as part of a regular message
await handleExpireTimer(
source,

View File

@ -33,7 +33,7 @@ export class ConversationController {
return this.conversations.get(id);
}
public getOrThrow(id: string) {
public getOrThrow(id: string): ConversationModel {
if (!this._initialFetchComplete) {
throw new Error(
'ConversationController.get() needs complete initial fetch'

View File

@ -262,7 +262,6 @@ export async function updateOrCreateClosedGroupV2(details: GroupInfo) {
}
await conversation.commit();
conversation.updateTextInputState();
const { expireTimer } = details;
@ -294,7 +293,7 @@ export async function leaveClosedGroupV2(groupId: string) {
// FIXME audric, add a flag to conversation model when a group is destroyed
if (isCurrentUserAdmin) {
window.log.info('Admin left a closed group v2. We need to destroy it');
convo.set({ left: true, isKickedFromGroup: true });
convo.set({ left: true });
members = [];
} else {
convo.set({ left: true });

View File

@ -77,7 +77,7 @@ export type ConversationType = {
primaryDevice: string;
isBlocked: boolean;
isKickedFromGroup: boolean;
leftGroup: boolean;
left: boolean;
avatarPath?: string; // absolute filepath to the avatar
};
export type ConversationLookupType = {

View File

@ -31,7 +31,7 @@ describe('state/selectors/conversations', () => {
isTyping: false,
isBlocked: false,
isKickedFromGroup: false,
leftGroup: false,
left: false,
},
id2: {
id: 'id2',
@ -52,7 +52,7 @@ describe('state/selectors/conversations', () => {
isTyping: false,
isBlocked: false,
isKickedFromGroup: false,
leftGroup: false,
left: false,
},
id3: {
id: 'id3',
@ -73,7 +73,7 @@ describe('state/selectors/conversations', () => {
isTyping: false,
isBlocked: false,
isKickedFromGroup: false,
leftGroup: false,
left: false,
},
id4: {
id: 'id4',
@ -93,7 +93,7 @@ describe('state/selectors/conversations', () => {
isTyping: false,
isBlocked: false,
isKickedFromGroup: false,
leftGroup: false,
left: false,
},
id5: {
id: 'id5',
@ -114,7 +114,7 @@ describe('state/selectors/conversations', () => {
isTyping: false,
isBlocked: false,
isKickedFromGroup: false,
leftGroup: false,
left: false,
},
};
const comparator = _getConversationComparator(i18n, regionCode);