fix ctx menu on repeated block/unblock

pull/1334/head
Audric Ackermann 5 years ago
parent d3badba681
commit 84c7ce006b
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -309,7 +309,7 @@ export class ConversationListItem extends React.PureComponent<Props> {
mentionedUs, mentionedUs,
} = this.props; } = this.props;
const triggerId = `${phoneNumber}-ctxmenu-${Date.now()}`; const triggerId = `conversation-item-${phoneNumber}-ctxmenu`;
return ( return (
<div> <div>

@ -389,7 +389,7 @@ export class ConversationHeader extends React.Component<Props> {
public render() { public render() {
const { id, isKickedFromGroup } = this.props; const { id, isKickedFromGroup } = this.props;
const triggerId = `conversation-${id}-${Date.now()}`; const triggerId = `conversation-header-${id}`;
return ( return (
<> <>

@ -1073,11 +1073,11 @@ export class Message extends React.PureComponent<Props, State> {
// It needs to be unique. // It needs to be unique.
// The Date.now() is a workaround to be sure a single triggerID with this id exists // The Date.now() is a workaround to be sure a single triggerID with this id exists
const triggerId = id const triggerId = id
? String(`${id}-${Date.now()}`) ? String(`message-${id}-${Date.now()}`)
: String(`${authorPhoneNumber}-${timestamp}`); : String(`message-${authorPhoneNumber}-${timestamp}`);
const rightClickTriggerId = id const rightClickTriggerId = id
? String(`${id}-ctx-${Date.now()}`) ? String(`message-ctx-${id}-${Date.now()}`)
: String(`${authorPhoneNumber}-ctx-${timestamp}`); : String(`message-ctx-${authorPhoneNumber}-${timestamp}`);
if (expired) { if (expired) {
return null; return null;
} }

@ -304,7 +304,14 @@ export function getResetSessionMenuItem(
action: any, action: any,
i18n: LocalizerType i18n: LocalizerType
): JSX.Element | null { ): JSX.Element | null {
if (showResetSession(Boolean(isPublic), Boolean(isRss), Boolean(isGroup), Boolean(isBlocked),)) { if (
showResetSession(
Boolean(isPublic),
Boolean(isRss),
Boolean(isGroup),
Boolean(isBlocked)
)
) {
return <MenuItem onClick={action}>{i18n('resetSession')}</MenuItem>; return <MenuItem onClick={action}>{i18n('resetSession')}</MenuItem>;
} }
return null; return null;

Loading…
Cancel
Save