Remove ability to set or read author E164 for new quotes

This commit is contained in:
Evan Hahn 2021-04-05 15:39:38 -05:00 committed by Josh Perez
parent 18ccda83ba
commit 8fe1be8678
6 changed files with 14 additions and 23 deletions

View File

@ -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;

View File

@ -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> = {}): 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 <Quote {...props} />;
});

4
ts/model-types.d.ts vendored
View File

@ -88,7 +88,9 @@ export type MessageAttributesType = {
profileChange: ProfileNameChangeType;
quote: {
attachments: Array<typeof window.WhatIsThis>;
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;

View File

@ -1234,7 +1234,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
const thumbnailWithObjectUrl =
!path && !objectUrl
? null
? undefined
: { ...(attachment.thumbnail || {}), objectUrl: path || objectUrl };
return {
@ -2026,19 +2026,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
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<string | null | void | Array<void>> {

1
ts/textsecure.d.ts vendored
View File

@ -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<DataMessageClass.Quote.QuotedAttachment>;

View File

@ -158,7 +158,6 @@ class Message {
quote?: {
id?: number;
author?: string;
authorUuid?: string;
text?: string;
attachments?: Array<AttachmentType>;
@ -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(