Improve types in ConversationView#showConversationDetails
This commit is contained in:
parent
6a72879c87
commit
e09fb6cce4
4 changed files with 13 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
@ -65,7 +65,9 @@ const createProps = (hasGroupLink = false): Props => ({
|
||||||
showGroupV2Permissions: action('showGroupV2Permissions'),
|
showGroupV2Permissions: action('showGroupV2Permissions'),
|
||||||
showPendingInvites: action('showPendingInvites'),
|
showPendingInvites: action('showPendingInvites'),
|
||||||
showLightboxForMedia: action('showLightboxForMedia'),
|
showLightboxForMedia: action('showLightboxForMedia'),
|
||||||
updateGroupAttributes: action('updateGroupAttributes'),
|
updateGroupAttributes: async () => {
|
||||||
|
action('updateGroupAttributes')();
|
||||||
|
},
|
||||||
onBlockAndDelete: action('onBlockAndDelete'),
|
onBlockAndDelete: action('onBlockAndDelete'),
|
||||||
onDelete: action('onDelete'),
|
onDelete: action('onDelete'),
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,7 +54,7 @@ export type StateProps = {
|
||||||
avatar?: undefined | ArrayBuffer;
|
avatar?: undefined | ArrayBuffer;
|
||||||
title?: string;
|
title?: string;
|
||||||
}>
|
}>
|
||||||
) => void;
|
) => Promise<void>;
|
||||||
onBlockAndDelete: () => void;
|
onBlockAndDelete: () => void;
|
||||||
onDelete: () => void;
|
onDelete: () => void;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020 Signal Messenger, LLC
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
@ -35,7 +35,7 @@ export type SmartConversationDetailsProps = {
|
||||||
avatar?: undefined | ArrayBuffer;
|
avatar?: undefined | ArrayBuffer;
|
||||||
title?: string;
|
title?: string;
|
||||||
}>
|
}>
|
||||||
) => void;
|
) => Promise<void>;
|
||||||
onBlockAndDelete: () => void;
|
onBlockAndDelete: () => void;
|
||||||
onDelete: () => void;
|
onDelete: () => void;
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { AttachmentType } from '../types/Attachment';
|
||||||
import { GroupV2PendingMemberType } from '../model-types.d';
|
import { GroupV2PendingMemberType } from '../model-types.d';
|
||||||
import { MediaItemType } from '../components/LightboxGallery';
|
import { MediaItemType } from '../components/LightboxGallery';
|
||||||
import { MessageType } from '../state/ducks/conversations';
|
import { MessageType } from '../state/ducks/conversations';
|
||||||
|
import { ConversationModel } from '../models/conversations';
|
||||||
|
|
||||||
type GetLinkPreviewImageResult = {
|
type GetLinkPreviewImageResult = {
|
||||||
data: ArrayBuffer;
|
data: ArrayBuffer;
|
||||||
|
@ -2851,7 +2852,7 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
showConversationDetails() {
|
showConversationDetails() {
|
||||||
const conversation = this.model;
|
const conversation: ConversationModel = this.model;
|
||||||
|
|
||||||
const messageRequestEnum =
|
const messageRequestEnum =
|
||||||
window.textsecure.protobuf.SyncMessage.MessageRequestResponse.Type;
|
window.textsecure.protobuf.SyncMessage.MessageRequestResponse.Type;
|
||||||
|
@ -2881,10 +2882,11 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
|
|
||||||
const ACCESS_ENUM = window.textsecure.protobuf.AccessControl.AccessRequired;
|
const ACCESS_ENUM = window.textsecure.protobuf.AccessControl.AccessRequired;
|
||||||
|
|
||||||
const hasGroupLink =
|
const hasGroupLink = Boolean(
|
||||||
conversation.get('groupInviteLinkPassword') &&
|
conversation.get('groupInviteLinkPassword') &&
|
||||||
conversation.get('accessControl')?.addFromInviteLink !==
|
conversation.get('accessControl')?.addFromInviteLink !==
|
||||||
ACCESS_ENUM.UNSATISFIABLE;
|
ACCESS_ENUM.UNSATISFIABLE
|
||||||
|
);
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
addMembers: conversation.addMembersV2.bind(conversation),
|
addMembers: conversation.addMembersV2.bind(conversation),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue