diff --git a/protos/SignalService.proto b/protos/SignalService.proto index d9a349142da4..b19f050322ae 100644 --- a/protos/SignalService.proto +++ b/protos/SignalService.proto @@ -117,7 +117,7 @@ message DataMessage { } optional uint64 id = 1; - optional string author = 2; + reserved /* author */ 2; // removed optional string authorUuid = 5; optional string text = 3; repeated QuotedAttachment attachments = 4; diff --git a/ts/components/conversation/Quote.stories.tsx b/ts/components/conversation/Quote.stories.tsx index 52d20174bb65..84e48cb64636 100644 --- a/ts/components/conversation/Quote.stories.tsx +++ b/ts/components/conversation/Quote.stories.tsx @@ -1,7 +1,8 @@ -// Copyright 2020 Signal Messenger, LLC +// Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; +import { isString } from 'lodash'; import { action } from '@storybook/addon-actions'; import { boolean, text } from '@storybook/addon-knobs'; @@ -127,7 +128,12 @@ const createProps = (overrideProps: Partial = {}): Props => ({ 'referencedMessageNotFound', overrideProps.referencedMessageNotFound || false ), - text: text('text', overrideProps.text || 'A sample message from a pal'), + text: text( + 'text', + isString(overrideProps.text) + ? overrideProps.text + : 'A sample message from a pal' + ), withContentAbove: boolean( 'withContentAbove', overrideProps.withContentAbove || false @@ -192,6 +198,7 @@ story.add('Content Above', () => { story.add('Image Only', () => { const props = createProps({ + text: '', rawAttachment: { contentType: IMAGE_PNG, fileName: 'sax.png', @@ -202,8 +209,6 @@ story.add('Image Only', () => { }, }, }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - props.text = undefined as any; return ; }); diff --git a/ts/model-types.d.ts b/ts/model-types.d.ts index 41a9d4bba977..d14551862a7a 100644 --- a/ts/model-types.d.ts +++ b/ts/model-types.d.ts @@ -88,7 +88,9 @@ export type MessageAttributesType = { profileChange: ProfileNameChangeType; quote: { attachments: Array; - author: string; + // `author` is an old attribute that holds the author's E164. We shouldn't use it for + // new messages, but old messages might have this attribute. + author?: string; authorUuid: string; bodyRanges: BodyRangesType; id: string; diff --git a/ts/models/messages.ts b/ts/models/messages.ts index 58d51af5db1e..f7234f386081 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -1234,7 +1234,7 @@ export class MessageModel extends window.Backbone.Model { const thumbnailWithObjectUrl = !path && !objectUrl - ? null + ? undefined : { ...(attachment.thumbnail || {}), objectUrl: path || objectUrl }; return { @@ -2026,19 +2026,6 @@ export class MessageModel extends window.Backbone.Model { return window.ConversationController.getOrCreate(source, 'private'); } - getQuoteContact(): ConversationModel | undefined | null { - const quote = this.get('quote'); - if (!quote) { - return null; - } - const { author } = quote; - if (!author) { - return null; - } - - return window.ConversationController.get(author); - } - // Send infrastructure // One caller today: event handler for the 'Retry Send' entry in triple-dot menu async retrySend(): Promise> { diff --git a/ts/textsecure.d.ts b/ts/textsecure.d.ts index 68f2b1475201..b8840fe8072e 100644 --- a/ts/textsecure.d.ts +++ b/ts/textsecure.d.ts @@ -720,7 +720,6 @@ export declare namespace DataMessageClass { // Note: deep nesting class Quote { id: ProtoBigNumberType | null; - author: string | null; authorUuid: string | null; text: string | null; attachments?: Array; diff --git a/ts/textsecure/SendMessage.ts b/ts/textsecure/SendMessage.ts index 77ab3106cec4..f6948adc4bca 100644 --- a/ts/textsecure/SendMessage.ts +++ b/ts/textsecure/SendMessage.ts @@ -158,7 +158,6 @@ class Message { quote?: { id?: number; - author?: string; authorUuid?: string; text?: string; attachments?: Array; @@ -337,7 +336,6 @@ class Message { const { quote } = proto; quote.id = this.quote.id || null; - quote.author = this.quote.author || null; quote.authorUuid = this.quote.authorUuid || null; quote.text = this.quote.text || null; quote.attachments = (this.quote.attachments || []).map(