diff --git a/js/models/messages.js b/js/models/messages.js index fae1fb5a5783..3e2bc44febaf 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -41,7 +41,7 @@ savePackMetadata, getStickerPackStatus, } = window.Signal.Stickers; - const { GoogleChrome } = window.Signal.Util; + const { GoogleChrome, getTextWithMentions } = window.Signal.Util; const { addStickerPackReference, getMessageBySender } = window.Signal.Data; const { bytesFromString } = window.Signal.Crypto; @@ -696,14 +696,6 @@ ); }, - getTextWithMentionStrings(bodyRanges, text) { - return bodyRanges.reduce((str, range) => { - const textBegin = str.substr(0, range.start); - const textEnd = str.substr(range.start + range.length, str.length); - return `${textBegin}@${range.replacementText}${textEnd}`; - }, text); - }, - // Dependencies of prop-generation functions findAndFormatContact(identifier) { if (!identifier) { @@ -1215,7 +1207,7 @@ if (hasMentions) { const bodyRanges = this.processBodyRanges(); - modifiedText = this.getTextWithMentionStrings(bodyRanges, modifiedText); + modifiedText = getTextWithMentions(bodyRanges, modifiedText); } // Linux emoji support is mixed, so we disable it. (Note that this doesn't touch diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 1ec764ff9900..bf6ccf4f5c5a 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -5285,10 +5285,10 @@ button.module-image__border-overlay:focus { @include light-theme { background-color: $color-gray-20; } + } - @include dark-theme { - background-color: $color-gray-60; - } + @include ios-dark-theme { + background-color: $color-gray-60; } } diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index b4a8c7cfce55..f36a590b7fbc 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -914,7 +914,6 @@ export class Message extends React.PureComponent { direction, disableScroll, i18n, - openConversation, quote, scrollToQuotedMessage, } = this.props; @@ -951,7 +950,6 @@ export class Message extends React.PureComponent { authorColor={quoteColor} authorTitle={quote.authorTitle} bodyRanges={quote.bodyRanges} - openConversation={openConversation} referencedMessageNotFound={referencedMessageNotFound} isFromMe={quote.isFromMe} withContentAbove={withContentAbove} diff --git a/ts/components/conversation/Quote.stories.tsx b/ts/components/conversation/Quote.stories.tsx index 48f3c61f1ffb..25a2f7115f4a 100644 --- a/ts/components/conversation/Quote.stories.tsx +++ b/ts/components/conversation/Quote.stories.tsx @@ -104,7 +104,6 @@ const createProps = (overrideProps: Partial = {}): Props => ({ isIncoming: boolean('isIncoming', overrideProps.isIncoming || false), onClick: action('onClick'), onClose: action('onClose'), - openConversation: action('openConversation'), referencedMessageNotFound: boolean( 'referencedMessageNotFound', overrideProps.referencedMessageNotFound || false diff --git a/ts/components/conversation/Quote.tsx b/ts/components/conversation/Quote.tsx index 3f54eae9a2e7..729aa4b816ee 100644 --- a/ts/components/conversation/Quote.tsx +++ b/ts/components/conversation/Quote.tsx @@ -8,6 +8,7 @@ import { MessageBody } from './MessageBody'; import { BodyRangesType, LocalizerType } from '../../types/Util'; import { ColorType } from '../../types/Colors'; import { ContactName } from './ContactName'; +import { getTextWithMentions } from '../../util/getTextWithMentions'; export interface Props { attachment?: QuotedAttachmentType; @@ -23,7 +24,6 @@ export interface Props { withContentAbove: boolean; onClick?: () => void; onClose?: () => void; - openConversation: (conversationId: string, messageId?: string) => void; text: string; referencedMessageNotFound: boolean; } @@ -238,16 +238,13 @@ export class Quote extends React.Component { } public renderText(): JSX.Element | null { - const { - bodyRanges, - i18n, - text, - attachment, - isIncoming, - openConversation, - } = this.props; + const { bodyRanges, i18n, text, attachment, isIncoming } = this.props; if (text) { + const quoteText = bodyRanges + ? getTextWithMentions(bodyRanges, text) + : text; + return (
{ isIncoming ? 'module-quote__primary__text--incoming' : null )} > - +
); } diff --git a/ts/util/getTextWithMentions.ts b/ts/util/getTextWithMentions.ts new file mode 100644 index 000000000000..81f141a9fa67 --- /dev/null +++ b/ts/util/getTextWithMentions.ts @@ -0,0 +1,12 @@ +import { BodyRangesType } from '../types/Util'; + +export function getTextWithMentions( + bodyRanges: BodyRangesType, + text: string +): string { + return bodyRanges.reduce((str, range) => { + const textBegin = str.substr(0, range.start); + const textEnd = str.substr(range.start + range.length, str.length); + return `${textBegin}@${range.replacementText}${textEnd}`; + }, text); +} diff --git a/ts/util/index.ts b/ts/util/index.ts index fba75f7cf7ec..0020fe9b69fa 100644 --- a/ts/util/index.ts +++ b/ts/util/index.ts @@ -11,6 +11,7 @@ import { getPlaceholder as getSafetyNumberPlaceholder, } from './safetyNumber'; import { getStringForProfileChange } from './getStringForProfileChange'; +import { getTextWithMentions } from './getTextWithMentions'; import { getUserAgent } from './getUserAgent'; import { hasExpired } from './hasExpired'; import { isFileDangerous } from './isFileDangerous'; @@ -30,6 +31,7 @@ export { generateSecurityNumber, getSafetyNumberPlaceholder, getStringForProfileChange, + getTextWithMentions, getUserAgent, GoogleChrome, hasExpired,