Fix ProfileChangeNotification update nickname contactId
This commit is contained in:
parent
3c3a50a193
commit
c14f5c4712
3 changed files with 15 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2020 Signal Messenger, LLC
|
// Copyright 2020 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import React from 'react';
|
import React, { useCallback } from 'react';
|
||||||
|
|
||||||
import type { LocalizerType } from '../../types/Util';
|
import type { LocalizerType } from '../../types/Util';
|
||||||
import type { ConversationType } from '../../state/ducks/conversations';
|
import type { ConversationType } from '../../state/ducks/conversations';
|
||||||
|
@ -16,7 +16,7 @@ export type PropsType = {
|
||||||
change: ProfileNameChangeType;
|
change: ProfileNameChangeType;
|
||||||
changedContact: ConversationType;
|
changedContact: ConversationType;
|
||||||
i18n: LocalizerType;
|
i18n: LocalizerType;
|
||||||
onOpenEditNicknameAndNoteModal: () => void;
|
onOpenEditNicknameAndNoteModal: (contactId: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function ProfileChangeNotification({
|
export function ProfileChangeNotification({
|
||||||
|
@ -26,6 +26,11 @@ export function ProfileChangeNotification({
|
||||||
onOpenEditNicknameAndNoteModal,
|
onOpenEditNicknameAndNoteModal,
|
||||||
}: PropsType): JSX.Element {
|
}: PropsType): JSX.Element {
|
||||||
const message = getStringForProfileChange(change, changedContact, i18n);
|
const message = getStringForProfileChange(change, changedContact, i18n);
|
||||||
|
const { id: contactId } = changedContact;
|
||||||
|
|
||||||
|
const handleOpenEditNicknameAndNoteModal = useCallback(() => {
|
||||||
|
onOpenEditNicknameAndNoteModal(contactId);
|
||||||
|
}, [contactId, onOpenEditNicknameAndNoteModal]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SystemMessage
|
<SystemMessage
|
||||||
|
@ -35,7 +40,7 @@ export function ProfileChangeNotification({
|
||||||
areNicknamesEnabled() &&
|
areNicknamesEnabled() &&
|
||||||
changedContact.nicknameGivenName != null && (
|
changedContact.nicknameGivenName != null && (
|
||||||
<Button
|
<Button
|
||||||
onClick={onOpenEditNicknameAndNoteModal}
|
onClick={handleOpenEditNicknameAndNoteModal}
|
||||||
size={ButtonSize.Small}
|
size={ButtonSize.Small}
|
||||||
variant={ButtonVariant.SystemMessage}
|
variant={ButtonVariant.SystemMessage}
|
||||||
>
|
>
|
||||||
|
|
|
@ -181,7 +181,7 @@ type PropsLocalType = {
|
||||||
isTargeted: boolean;
|
isTargeted: boolean;
|
||||||
targetMessage: (messageId: string, conversationId: string) => unknown;
|
targetMessage: (messageId: string, conversationId: string) => unknown;
|
||||||
shouldRenderDateHeader: boolean;
|
shouldRenderDateHeader: boolean;
|
||||||
onOpenEditNicknameAndNoteModal: () => void;
|
onOpenEditNicknameAndNoteModal: (contactId: string) => void;
|
||||||
onOpenMessageRequestActionsConfirmation(state: MessageRequestState): void;
|
onOpenMessageRequestActionsConfirmation(state: MessageRequestState): void;
|
||||||
platform: string;
|
platform: string;
|
||||||
renderContact: SmartContactRendererType<JSX.Element>;
|
renderContact: SmartContactRendererType<JSX.Element>;
|
||||||
|
|
|
@ -156,9 +156,12 @@ export const SmartTimelineItem = memo(function SmartTimelineItem(
|
||||||
returnToActiveCall,
|
returnToActiveCall,
|
||||||
} = useCallingActions();
|
} = useCallingActions();
|
||||||
|
|
||||||
const onOpenEditNicknameAndNoteModal = useCallback(() => {
|
const onOpenEditNicknameAndNoteModal = useCallback(
|
||||||
toggleEditNicknameAndNoteModal({ conversationId });
|
(contactId: string) => {
|
||||||
}, [conversationId, toggleEditNicknameAndNoteModal]);
|
toggleEditNicknameAndNoteModal({ conversationId: contactId });
|
||||||
|
},
|
||||||
|
[toggleEditNicknameAndNoteModal]
|
||||||
|
);
|
||||||
|
|
||||||
const onOpenMessageRequestActionsConfirmation = useCallback(
|
const onOpenMessageRequestActionsConfirmation = useCallback(
|
||||||
(state: MessageRequestState) => {
|
(state: MessageRequestState) => {
|
||||||
|
|
Loading…
Reference in a new issue