` tags. */
disableLinks: boolean;
+ isGroup: boolean;
};
-const renderMentions: RenderTextCallbackType = ({ text, key }) => (
-
+const renderMentions: RenderTextCallbackType = ({ text, key, isGroup }) => (
+
);
-export const renderTextDefault: RenderTextCallbackType = ({ text }) => text;
+export const renderTextDefault: RenderTextCallbackType = ({ text }) => <>{text}>;
const renderNewLines: RenderTextCallbackType = ({ text: textWithNewLines, key, isGroup }) => {
const renderOther = isGroup ? renderMentions : renderTextDefault;
- return ;
+ return (
+
+ );
};
const renderEmoji = ({
@@ -31,12 +39,22 @@ const renderEmoji = ({
key,
sizeClass,
renderNonEmoji,
+ isGroup,
}: {
text: string;
key: number;
sizeClass: SizeClassType;
renderNonEmoji: RenderTextCallbackType;
-}) => ;
+ isGroup: boolean;
+}) => (
+
+);
/**
* This component makes it very easy to use all three of our message formatting
@@ -60,7 +78,7 @@ const JsxSelectable = (jsx: JSX.Element): JSX.Element => {
);
};
export const MessageBody = (props: Props) => {
- const { text, disableJumbomoji, disableLinks } = props;
+ const { text, disableJumbomoji, disableLinks, isGroup } = props;
const sizeClass: SizeClassType = disableJumbomoji ? 'default' : getEmojiSizeClass(text);
if (disableLinks) {
@@ -70,24 +88,26 @@ export const MessageBody = (props: Props) => {
sizeClass,
key: 0,
renderNonEmoji: renderNewLines,
+ isGroup,
})
);
}
if (text && text.startsWith('```') && text.endsWith('```')) {
- const length = text.length;
- return {text.substring(4, length - 3)}
;
+ return {text.substring(4, text.length - 3)}
;
}
return JsxSelectable(
{
return renderEmoji({
text: nonLinkText,
sizeClass,
key,
renderNonEmoji: renderNewLines,
+ isGroup,
});
}}
/>
diff --git a/ts/components/conversation/message/message-content/MessageText.tsx b/ts/components/conversation/message/message-content/MessageText.tsx
index 136d68a7d..aee070f52 100644
--- a/ts/components/conversation/message/message-content/MessageText.tsx
+++ b/ts/components/conversation/message/message-content/MessageText.tsx
@@ -15,7 +15,7 @@ type Props = {
export type MessageTextSelectorProps = Pick<
MessageRenderingProps,
- 'text' | 'direction' | 'status' | 'isDeleted'
+ 'text' | 'direction' | 'status' | 'isDeleted' | 'conversationType'
>;
export const MessageText = (props: Props) => {
@@ -25,7 +25,7 @@ export const MessageText = (props: Props) => {
if (!selected) {
return null;
}
- const { text, direction, status, isDeleted } = selected;
+ const { text, direction, status, isDeleted, conversationType } = selected;
const contents = isDeleted
? window.i18n('messageDeletedPlaceholder')
@@ -47,7 +47,12 @@ export const MessageText = (props: Props) => {
)}
>
{isDeleted && }
-
+
);
};
diff --git a/ts/components/conversation/message/message-content/Quote.tsx b/ts/components/conversation/message/message-content/Quote.tsx
index e7f44e185..d3e2c2b23 100644
--- a/ts/components/conversation/message/message-content/Quote.tsx
+++ b/ts/components/conversation/message/message-content/Quote.tsx
@@ -10,9 +10,13 @@ import { noop } from 'lodash';
import { useDisableDrag } from '../../../../hooks/useDisableDrag';
import { useEncryptedFileFetch } from '../../../../hooks/useEncryptedFileFetch';
import { PubKey } from '../../../../session/types';
-import { isPublicGroupConversation } from '../../../../state/selectors/conversations';
+import {
+ getSelectedConversationKey,
+ isPublicGroupConversation,
+} from '../../../../state/selectors/conversations';
import { ContactName } from '../../ContactName';
import { MessageBody } from './MessageBody';
+import { useIsPrivate } from '../../../../hooks/useParamSelector';
export type QuotePropsWithoutListener = {
attachment?: QuotedAttachmentType;
@@ -225,6 +229,9 @@ export const QuoteText = (
) => {
const { text, attachment, isIncoming } = props;
+ const convoId = useSelector(getSelectedConversationKey);
+ const isGroup = useIsPrivate(convoId);
+
if (text) {
return (
-
+
);
}
diff --git a/ts/components/leftpane/ContactListItem.tsx b/ts/components/leftpane/ContactListItem.tsx
index 679046dc3..a294d0d96 100644
--- a/ts/components/leftpane/ContactListItem.tsx
+++ b/ts/components/leftpane/ContactListItem.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
-import { useConversationUsername, useIsMe } from '../../hooks/useParamSelector';
+import { useConversationUsername, useIsMe, useIsPrivate } from '../../hooks/useParamSelector';
import { Avatar, AvatarSize } from '../avatar/Avatar';
import { Emojify } from '../conversation/Emojify';
@@ -20,6 +20,7 @@ export const ContactListItem = (props: Props) => {
const name = useConversationUsername(pubkey);
const isMe = useIsMe(pubkey);
+ const isGroup = !useIsPrivate(pubkey);
const title = name ? name : pubkey;
const displayName = isMe ? window.i18n('me') : title;
@@ -36,7 +37,7 @@ export const ContactListItem = (props: Props) => {
diff --git a/ts/components/leftpane/conversation-list-item/MessageItem.tsx b/ts/components/leftpane/conversation-list-item/MessageItem.tsx
index 71883272b..a87384cfe 100644
--- a/ts/components/leftpane/conversation-list-item/MessageItem.tsx
+++ b/ts/components/leftpane/conversation-list-item/MessageItem.tsx
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import React, { useContext } from 'react';
import { isEmpty } from 'lodash';
-import { useConversationPropsById } from '../../../hooks/useParamSelector';
+import { useConversationPropsById, useIsPrivate } from '../../../hooks/useParamSelector';
import { MessageBody } from '../../conversation/message/message-content/MessageBody';
import { OutgoingMessageStatus } from '../../conversation/message/message-content/OutgoingMessageStatus';
import { TypingAnimation } from '../../conversation/TypingAnimation';
@@ -26,6 +26,8 @@ export const MessageItem = (props: { isMessageRequest: boolean }) => {
const conversationId = useContext(ContextConversationId);
const convoProps = useMessageItemProps(conversationId);
+ const isGroup = !!useIsPrivate(conversationId);
+
const isSearchingMode = useSelector(isSearching);
if (!convoProps) {
return null;
@@ -52,7 +54,7 @@ export const MessageItem = (props: { isMessageRequest: boolean }) => {
{isTyping ? (
) : (
-
+
)}
diff --git a/ts/components/search/MessageSearchResults.tsx b/ts/components/search/MessageSearchResults.tsx
index 926dbf32b..546226330 100644
--- a/ts/components/search/MessageSearchResults.tsx
+++ b/ts/components/search/MessageSearchResults.tsx
@@ -230,7 +230,7 @@ export const MessageSearchResult = (props: MessageResultProps) => {
-
+
diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts
index 51206eeb6..563d55d88 100644
--- a/ts/state/selectors/conversations.ts
+++ b/ts/state/selectors/conversations.ts
@@ -577,7 +577,7 @@ export const isRightPanelShowing = createSelector(
export const isMessageSelectionMode = createSelector(
getConversations,
- (state: ConversationsStateType): boolean => state.selectedMessageIds.length > 0
+ (state: ConversationsStateType): boolean => Boolean(state.selectedMessageIds.length > 0)
);
export const getSelectedMessageIds = createSelector(
@@ -907,13 +907,14 @@ export const getMessageTextProps = createSelector(getMessagePropsByMessageId, (p
return undefined;
}
- const { direction, status, text, isDeleted } = props.propsForMessage;
+ const { direction, status, text, isDeleted, conversationType } = props.propsForMessage;
const msgProps: MessageTextSelectorProps = {
direction,
status,
text,
isDeleted,
+ conversationType,
};
return msgProps;
diff --git a/ts/types/Util.ts b/ts/types/Util.ts
index 5f17f5e81..ccea6b792 100644
--- a/ts/types/Util.ts
+++ b/ts/types/Util.ts
@@ -3,7 +3,7 @@ import { LocalizerKeys } from './LocalizerKeys';
export type RenderTextCallbackType = (options: {
text: string;
key: number;
- isGroup?: boolean;
-}) => JSX.Element | string;
+ isGroup: boolean;
+}) => JSX.Element;
export type LocalizerType = (key: LocalizerKeys, values?: Array) => string;