Improve types in ConversationView#showConversationDetails

This commit is contained in:
Evan Hahn 2021-03-12 17:31:47 -06:00 committed by Josh Perez
parent 6a72879c87
commit e09fb6cce4
4 changed files with 13 additions and 9 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2020 Signal Messenger, LLC
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
@ -65,7 +65,9 @@ const createProps = (hasGroupLink = false): Props => ({
showGroupV2Permissions: action('showGroupV2Permissions'),
showPendingInvites: action('showPendingInvites'),
showLightboxForMedia: action('showLightboxForMedia'),
updateGroupAttributes: action('updateGroupAttributes'),
updateGroupAttributes: async () => {
action('updateGroupAttributes')();
},
onBlockAndDelete: action('onBlockAndDelete'),
onDelete: action('onDelete'),
});

View file

@ -54,7 +54,7 @@ export type StateProps = {
avatar?: undefined | ArrayBuffer;
title?: string;
}>
) => void;
) => Promise<void>;
onBlockAndDelete: () => void;
onDelete: () => void;
};

View file

@ -1,4 +1,4 @@
// Copyright 2020 Signal Messenger, LLC
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { connect } from 'react-redux';
@ -35,7 +35,7 @@ export type SmartConversationDetailsProps = {
avatar?: undefined | ArrayBuffer;
title?: string;
}>
) => void;
) => Promise<void>;
onBlockAndDelete: () => void;
onDelete: () => void;
};

View file

@ -7,6 +7,7 @@ import { AttachmentType } from '../types/Attachment';
import { GroupV2PendingMemberType } from '../model-types.d';
import { MediaItemType } from '../components/LightboxGallery';
import { MessageType } from '../state/ducks/conversations';
import { ConversationModel } from '../models/conversations';
type GetLinkPreviewImageResult = {
data: ArrayBuffer;
@ -2851,7 +2852,7 @@ Whisper.ConversationView = Whisper.View.extend({
},
showConversationDetails() {
const conversation = this.model;
const conversation: ConversationModel = this.model;
const messageRequestEnum =
window.textsecure.protobuf.SyncMessage.MessageRequestResponse.Type;
@ -2881,10 +2882,11 @@ Whisper.ConversationView = Whisper.View.extend({
const ACCESS_ENUM = window.textsecure.protobuf.AccessControl.AccessRequired;
const hasGroupLink =
const hasGroupLink = Boolean(
conversation.get('groupInviteLinkPassword') &&
conversation.get('accessControl')?.addFromInviteLink !==
ACCESS_ENUM.UNSATISFIABLE;
conversation.get('accessControl')?.addFromInviteLink !==
ACCESS_ENUM.UNSATISFIABLE
);
const props = {
addMembers: conversation.addMembersV2.bind(conversation),