diff --git a/ts/components/conversation/message/message-content/MessageContextMenu.tsx b/ts/components/conversation/message/message-content/MessageContextMenu.tsx
index e4d3200aa..c9f00f426 100644
--- a/ts/components/conversation/message/message-content/MessageContextMenu.tsx
+++ b/ts/components/conversation/message/message-content/MessageContextMenu.tsx
@@ -48,6 +48,8 @@ import { Reactions } from '../../../../util/reactions';
import { SessionContextMenuContainer } from '../../../SessionContextMenuContainer';
import { SessionEmojiPanel, StyledEmojiPanel } from '../../SessionEmojiPanel';
import { MessageReactBar } from './MessageReactBar';
+import { showCopyAccountIdAction } from '../../../menu/items/CopyAccountId';
+import { CopyAccountIdMenuItem } from '../../../menu/items/CopyAccountId/CopyAccountIdMenuItem';
export type MessageContextMenuSelectorProps = Pick<
MessageRenderingProps,
@@ -382,6 +384,10 @@ export const MessageContextMenu = (props: Props) => {
>
{window.i18n('info')}
+ {/* this is a message in the view, so always private */}
+ {sender && showCopyAccountIdAction({ isPrivate: true, pubkey: sender }) ? (
+
+ ) : null}
{isDeletable ? - {selectMessageText}
: null}
diff --git a/ts/components/conversation/message/message-content/quote/Quote.tsx b/ts/components/conversation/message/message-content/quote/Quote.tsx
index 5181e2e1d..ff3c8c982 100644
--- a/ts/components/conversation/message/message-content/quote/Quote.tsx
+++ b/ts/components/conversation/message/message-content/quote/Quote.tsx
@@ -37,6 +37,7 @@ const StyledQuoteTextContent = styled.div`
padding-inline-start: 10px;
padding-inline-end: 10px;
max-width: 100%;
+ overflow: hidden;
display: flex;
flex-direction: column;
diff --git a/ts/components/conversation/right-panel/overlay/message-info/OverlayMessageInfo.tsx b/ts/components/conversation/right-panel/overlay/message-info/OverlayMessageInfo.tsx
index 814d191d2..cf0d9d195 100644
--- a/ts/components/conversation/right-panel/overlay/message-info/OverlayMessageInfo.tsx
+++ b/ts/components/conversation/right-panel/overlay/message-info/OverlayMessageInfo.tsx
@@ -19,7 +19,6 @@ import {
resendMessage,
} from '../../../../../interactions/conversationInteractions';
import { deleteMessagesById } from '../../../../../interactions/conversations/unsendingInteractions';
-import { PubKey } from '../../../../../session/types';
import {
useMessageAttachments,
useMessageAuthor,
@@ -52,6 +51,7 @@ import { Message } from '../../../message/message-item/Message';
import { AttachmentInfo, MessageInfo } from './components';
import { AttachmentCarousel } from './components/AttachmentCarousel';
import { ToastUtils } from '../../../../../session/utils';
+import { showCopyAccountIdAction } from '../../../../menu/items/CopyAccountId';
// NOTE we override the default max-widths when in the detail isDetailView
const StyledMessageBody = styled.div`
@@ -242,9 +242,10 @@ function CopySenderSessionId({ messageId }: WithMessageIdOpt) {
const senderId = useMessageAuthor(messageId);
const isGroup = isGroupOrCommunity && !isPublic;
- const isPrivateButNotBlinded = senderId && isPrivate && !PubKey.isBlinded(senderId);
+ const isPrivateAndShouldShow =
+ senderId && showCopyAccountIdAction({ isPrivate, pubkey: senderId });
- if (senderId && (isGroup || isPrivateButNotBlinded)) {
+ if (senderId && (isGroup || isPrivateAndShouldShow)) {
return (
const { triggerId } = props;
const isSearching = useIsSearching();
+ const convoIdFromContext = useConvoIdFromContext();
+
if (isSearching) {
return null;
}
@@ -51,7 +54,8 @@ const ConversationListItemContextMenu = (props: PropsContextConversationItem) =>
-
+
+
{/* Read state actions */}
diff --git a/ts/components/menu/Menu.tsx b/ts/components/menu/Menu.tsx
index eea39f542..253efd3dd 100644
--- a/ts/components/menu/Menu.tsx
+++ b/ts/components/menu/Menu.tsx
@@ -24,7 +24,6 @@ import {
approveConvoAndSendResponse,
blockConvoById,
clearNickNameByConvoId,
- copyPublicKeyByConvoId,
declineConversationWithConfirm,
deleteAllMessagesByConvoIdWithConfirmation,
markAllReadByConvoId,
@@ -39,6 +38,10 @@ import {
showUpdateGroupNameByConvoId,
unblockConvoById,
} from '../../interactions/conversationInteractions';
+import {
+ ConversationInteractionStatus,
+ ConversationInteractionType,
+} from '../../interactions/types';
import {
ConversationNotificationSetting,
ConversationNotificationSettingType,
@@ -54,10 +57,6 @@ import { getIsMessageSection } from '../../state/selectors/section';
import { useSelectedConversationKey } from '../../state/selectors/selectedConversation';
import { LocalizerToken } from '../../types/Localizer';
import { SessionButtonColor } from '../basic/SessionButton';
-import {
- ConversationInteractionType,
- ConversationInteractionStatus,
-} from '../../interactions/types';
/** Menu items standardized */
@@ -297,29 +296,6 @@ export const BanMenuItem = (): JSX.Element | null => {
return null;
};
-export const CopyMenuItem = (): JSX.Element | null => {
- const convoId = useConvoIdFromContext();
- const isPublic = useIsPublic(convoId);
- const isPrivate = useIsPrivate(convoId);
- const isBlinded = useIsBlinded(convoId);
-
- // we want to show the copyId for open groups and private chats only
-
- if ((isPrivate && !isBlinded) || isPublic) {
- const copyIdLabel = isPublic ? window.i18n('communityUrlCopy') : window.i18n('accountIDCopy');
- return (
- - {
- void copyPublicKeyByConvoId(convoId);
- }}
- >
- {copyIdLabel}
-
- );
- }
- return null;
-};
-
export const MarkAllReadMenuItem = (): JSX.Element | null => {
const convoId = useConvoIdFromContext();
const isIncomingRequest = useIsIncomingRequest(convoId);
diff --git a/ts/components/menu/items/CopyAccountId/CopyAccountIdMenuItem.tsx b/ts/components/menu/items/CopyAccountId/CopyAccountIdMenuItem.tsx
new file mode 100644
index 000000000..d1e457571
--- /dev/null
+++ b/ts/components/menu/items/CopyAccountId/CopyAccountIdMenuItem.tsx
@@ -0,0 +1,28 @@
+import { Item } from 'react-contexify';
+import { useIsPrivate } from '../../../../hooks/useParamSelector';
+import { copyPublicKeyByConvoId } from '../../../../interactions/conversationInteractions';
+import { Localizer } from '../../../basic/Localizer';
+import { showCopyAccountIdAction } from '.';
+
+/**
+ * Can be used to copy the conversation AccountID or the message's author sender'id.
+ * Depending on what the pubkey is
+ */
+export const CopyAccountIdMenuItem = ({ pubkey }: { pubkey: string }): JSX.Element | null => {
+ const isPrivate = useIsPrivate(pubkey);
+
+ // we want to show the copyId for communities only
+
+ if (showCopyAccountIdAction({ isPrivate, pubkey })) {
+ return (
+ - {
+ void copyPublicKeyByConvoId(pubkey);
+ }}
+ >
+
+
+ );
+ }
+ return null;
+};
diff --git a/ts/components/menu/items/CopyAccountId/index.ts b/ts/components/menu/items/CopyAccountId/index.ts
new file mode 100644
index 000000000..9f52d7247
--- /dev/null
+++ b/ts/components/menu/items/CopyAccountId/index.ts
@@ -0,0 +1,11 @@
+import { PubKey } from '../../../../session/types';
+
+export function showCopyAccountIdAction({
+ isPrivate,
+ pubkey,
+}: {
+ isPrivate: boolean;
+ pubkey: string;
+}) {
+ return isPrivate && !PubKey.isBlinded(pubkey);
+}
diff --git a/ts/components/menu/items/CopyCommunityUrl/CopyCommunityUrlMenuItem.tsx b/ts/components/menu/items/CopyCommunityUrl/CopyCommunityUrlMenuItem.tsx
new file mode 100644
index 000000000..e587e3a0c
--- /dev/null
+++ b/ts/components/menu/items/CopyCommunityUrl/CopyCommunityUrlMenuItem.tsx
@@ -0,0 +1,24 @@
+import { Item } from 'react-contexify';
+import { showCopyCommunityUrlMenuItem } from '.';
+import { useIsPublic } from '../../../../hooks/useParamSelector';
+import { copyPublicKeyByConvoId } from '../../../../interactions/conversationInteractions';
+import { Localizer } from '../../../basic/Localizer';
+
+export const CopyCommunityUrlMenuItem = ({ convoId }: { convoId: string }): JSX.Element | null => {
+ const isPublic = useIsPublic(convoId);
+
+ // we want to show the copyId for communities only
+
+ if (showCopyCommunityUrlMenuItem({ isPublic })) {
+ return (
+ - {
+ void copyPublicKeyByConvoId(convoId);
+ }}
+ >
+
+
+ );
+ }
+ return null;
+};
diff --git a/ts/components/menu/items/CopyCommunityUrl/index.ts b/ts/components/menu/items/CopyCommunityUrl/index.ts
new file mode 100644
index 000000000..c908f81e2
--- /dev/null
+++ b/ts/components/menu/items/CopyCommunityUrl/index.ts
@@ -0,0 +1,3 @@
+export function showCopyCommunityUrlMenuItem({ isPublic }: { isPublic: boolean }) {
+ return isPublic;
+}