Remove ability to set or read author E164 for new quotes
This commit is contained in:
parent
18ccda83ba
commit
8fe1be8678
6 changed files with 14 additions and 23 deletions
|
@ -117,7 +117,7 @@ message DataMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
optional uint64 id = 1;
|
optional uint64 id = 1;
|
||||||
optional string author = 2;
|
reserved /* author */ 2; // removed
|
||||||
optional string authorUuid = 5;
|
optional string authorUuid = 5;
|
||||||
optional string text = 3;
|
optional string text = 3;
|
||||||
repeated QuotedAttachment attachments = 4;
|
repeated QuotedAttachment attachments = 4;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// Copyright 2020 Signal Messenger, LLC
|
// Copyright 2020-2021 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { isString } from 'lodash';
|
||||||
|
|
||||||
import { action } from '@storybook/addon-actions';
|
import { action } from '@storybook/addon-actions';
|
||||||
import { boolean, text } from '@storybook/addon-knobs';
|
import { boolean, text } from '@storybook/addon-knobs';
|
||||||
|
@ -127,7 +128,12 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
||||||
'referencedMessageNotFound',
|
'referencedMessageNotFound',
|
||||||
overrideProps.referencedMessageNotFound || false
|
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: boolean(
|
||||||
'withContentAbove',
|
'withContentAbove',
|
||||||
overrideProps.withContentAbove || false
|
overrideProps.withContentAbove || false
|
||||||
|
@ -192,6 +198,7 @@ story.add('Content Above', () => {
|
||||||
|
|
||||||
story.add('Image Only', () => {
|
story.add('Image Only', () => {
|
||||||
const props = createProps({
|
const props = createProps({
|
||||||
|
text: '',
|
||||||
rawAttachment: {
|
rawAttachment: {
|
||||||
contentType: IMAGE_PNG,
|
contentType: IMAGE_PNG,
|
||||||
fileName: 'sax.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} />;
|
return <Quote {...props} />;
|
||||||
});
|
});
|
||||||
|
|
4
ts/model-types.d.ts
vendored
4
ts/model-types.d.ts
vendored
|
@ -88,7 +88,9 @@ export type MessageAttributesType = {
|
||||||
profileChange: ProfileNameChangeType;
|
profileChange: ProfileNameChangeType;
|
||||||
quote: {
|
quote: {
|
||||||
attachments: Array<typeof window.WhatIsThis>;
|
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;
|
authorUuid: string;
|
||||||
bodyRanges: BodyRangesType;
|
bodyRanges: BodyRangesType;
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
@ -1234,7 +1234,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
|
|
||||||
const thumbnailWithObjectUrl =
|
const thumbnailWithObjectUrl =
|
||||||
!path && !objectUrl
|
!path && !objectUrl
|
||||||
? null
|
? undefined
|
||||||
: { ...(attachment.thumbnail || {}), objectUrl: path || objectUrl };
|
: { ...(attachment.thumbnail || {}), objectUrl: path || objectUrl };
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -2026,19 +2026,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
return window.ConversationController.getOrCreate(source, 'private');
|
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
|
// Send infrastructure
|
||||||
// One caller today: event handler for the 'Retry Send' entry in triple-dot menu
|
// One caller today: event handler for the 'Retry Send' entry in triple-dot menu
|
||||||
async retrySend(): Promise<string | null | void | Array<void>> {
|
async retrySend(): Promise<string | null | void | Array<void>> {
|
||||||
|
|
1
ts/textsecure.d.ts
vendored
1
ts/textsecure.d.ts
vendored
|
@ -720,7 +720,6 @@ export declare namespace DataMessageClass {
|
||||||
// Note: deep nesting
|
// Note: deep nesting
|
||||||
class Quote {
|
class Quote {
|
||||||
id: ProtoBigNumberType | null;
|
id: ProtoBigNumberType | null;
|
||||||
author: string | null;
|
|
||||||
authorUuid: string | null;
|
authorUuid: string | null;
|
||||||
text: string | null;
|
text: string | null;
|
||||||
attachments?: Array<DataMessageClass.Quote.QuotedAttachment>;
|
attachments?: Array<DataMessageClass.Quote.QuotedAttachment>;
|
||||||
|
|
|
@ -158,7 +158,6 @@ class Message {
|
||||||
|
|
||||||
quote?: {
|
quote?: {
|
||||||
id?: number;
|
id?: number;
|
||||||
author?: string;
|
|
||||||
authorUuid?: string;
|
authorUuid?: string;
|
||||||
text?: string;
|
text?: string;
|
||||||
attachments?: Array<AttachmentType>;
|
attachments?: Array<AttachmentType>;
|
||||||
|
@ -337,7 +336,6 @@ class Message {
|
||||||
const { quote } = proto;
|
const { quote } = proto;
|
||||||
|
|
||||||
quote.id = this.quote.id || null;
|
quote.id = this.quote.id || null;
|
||||||
quote.author = this.quote.author || null;
|
|
||||||
quote.authorUuid = this.quote.authorUuid || null;
|
quote.authorUuid = this.quote.authorUuid || null;
|
||||||
quote.text = this.quote.text || null;
|
quote.text = this.quote.text || null;
|
||||||
quote.attachments = (this.quote.attachments || []).map(
|
quote.attachments = (this.quote.attachments || []).map(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue