Fix action propagation to timeline items

This commit is contained in:
Fedor Indutny 2021-09-12 19:36:41 -07:00 committed by GitHub
parent 9ffa29ca0d
commit 5a57e2b704
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 71 additions and 66 deletions

View file

@ -50,39 +50,42 @@ export type CompositionAPIType = {
resetEmojiResults: InputApi['resetEmojiResults'];
};
export type OwnProps = {
readonly i18n: LocalizerType;
readonly areWePending?: boolean;
readonly areWePendingApproval?: boolean;
readonly announcementsOnly?: boolean;
readonly areWeAdmin?: boolean;
readonly groupAdmins: Array<ConversationType>;
readonly groupVersion?: 1 | 2;
readonly isGroupV1AndDisabled?: boolean;
readonly isMissingMandatoryProfileSharing?: boolean;
readonly isSMSOnly?: boolean;
readonly isFetchingUUID?: boolean;
readonly left?: boolean;
readonly messageRequestsEnabled?: boolean;
readonly acceptedMessageRequest?: boolean;
readonly compositionApi?: React.MutableRefObject<CompositionAPIType>;
readonly micCellEl?: HTMLElement;
readonly draftAttachments: Array<AttachmentType>;
readonly shouldSendHighQualityAttachments: boolean;
export type OwnProps = Readonly<{
i18n: LocalizerType;
areWePending?: boolean;
areWePendingApproval?: boolean;
announcementsOnly?: boolean;
areWeAdmin?: boolean;
groupAdmins: Array<ConversationType>;
groupVersion?: 1 | 2;
isGroupV1AndDisabled?: boolean;
isMissingMandatoryProfileSharing?: boolean;
isSMSOnly?: boolean;
isFetchingUUID?: boolean;
left?: boolean;
messageRequestsEnabled?: boolean;
acceptedMessageRequest?: boolean;
compositionApi?: React.MutableRefObject<CompositionAPIType>;
micCellEl?: HTMLElement;
draftAttachments: ReadonlyArray<AttachmentType>;
shouldSendHighQualityAttachments: boolean;
onChooseAttachment(): unknown;
onAddAttachment(): unknown;
onClickAttachment(): unknown;
onCloseAttachment(): unknown;
onClearAttachments(): unknown;
onSelectMediaQuality(isHQ: boolean): unknown;
readonly quotedMessageProps?: QuoteProps;
quotedMessageProps?: Omit<
QuoteProps,
'i18n' | 'onClick' | 'onClose' | 'withContentAbove'
>;
onClickQuotedMessage(): unknown;
setQuotedMessage(message: undefined): unknown;
linkPreviewLoading: boolean;
linkPreviewResult?: LinkPreviewWithDomain;
onCloseLinkPreview(): unknown;
openConversation(conversationId: string): unknown;
};
}>;
export type Props = Pick<
CompositionInputProps,

View file

@ -23,7 +23,7 @@ type PropsType = {
toggleProfileEditor: () => unknown;
toggleProfileEditorHasError: () => unknown;
} & PropsDataType &
ProfileEditorPropsType;
Omit<ProfileEditorPropsType, 'onEditStateChanged' | 'onProfileChanged'>;
export const ProfileEditorModal = ({
hasError,

View file

@ -15,14 +15,14 @@ import {
isVideoAttachment,
} from '../../types/Attachment';
export type Props = {
attachments: Array<AttachmentType>;
export type Props = Readonly<{
attachments: ReadonlyArray<AttachmentType>;
i18n: LocalizerType;
onAddAttachment?: () => void;
onClickAttachment?: (attachment: AttachmentType) => void;
onClose?: () => void;
onCloseAttachment: (attachment: AttachmentType) => void;
};
}>;
const IMAGE_WIDTH = 120;
const IMAGE_HEIGHT = 120;

View file

@ -25,7 +25,7 @@ export type Props = {
bodyRanges?: BodyRangesType;
i18n: LocalizerType;
isFromMe: boolean;
isIncoming: boolean;
isIncoming?: boolean;
withContentAbove: boolean;
onClick?: () => void;
onClose?: () => void;
@ -33,7 +33,7 @@ export type Props = {
rawAttachment?: QuotedAttachmentType;
isViewOnce: boolean;
referencedMessageNotFound: boolean;
doubleCheckMissingQuoteReference: () => unknown;
doubleCheckMissingQuoteReference?: () => unknown;
};
type State = {
@ -133,7 +133,7 @@ export class Quote extends React.Component<Props, State> {
} = this.props;
if (referencedMessageNotFound) {
doubleCheckMissingQuoteReference();
doubleCheckMissingQuoteReference?.();
}
}

View file

@ -77,7 +77,7 @@ export type PropsDataType = {
haveOldest: boolean;
isLoadingMessages: boolean;
isNearBottom?: boolean;
items: Array<string>;
items: ReadonlyArray<string>;
loadCountdownStart?: number;
messageHeightChangeIndex?: number;
oldestUnreadIndex?: number;
@ -104,7 +104,7 @@ type PropsHousekeepingType = {
i18n: LocalizerType;
renderItem: (props: {
actions: PropsActionsType;
actionProps: PropsActionsType;
containerElementRef: RefObject<HTMLElement>;
conversationId: string;
messageId: string;
@ -804,7 +804,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
const nextMessageId: undefined | string = items[itemIndex + 1];
stableKey = messageId;
const actions = getActions(this.props);
const actionProps = getActions(this.props);
rowContents = (
<div
@ -816,7 +816,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
>
<ErrorBoundary i18n={i18n} showDebugLog={() => window.showDebugLog()}>
{renderItem({
actions,
actionProps,
containerElementRef: this.containerRef,
conversationId: id,
messageId,