Quotes: Use authorId when navigating to original message

This commit is contained in:
Scott Nonnenberg 2020-12-11 10:06:04 -08:00 committed by GitHub
parent 3715309f9c
commit 0506b79f6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View file

@ -185,7 +185,10 @@ export type PropsActions = {
displayTapToViewMessage: (messageId: string) => unknown; displayTapToViewMessage: (messageId: string) => unknown;
openLink: (url: string) => void; openLink: (url: string) => void;
scrollToQuotedMessage: (options: { author: string; sentAt: number }) => void; scrollToQuotedMessage: (options: {
authorId: string;
sentAt: number;
}) => void;
selectMessage?: (messageId: string, conversationId: string) => unknown; selectMessage?: (messageId: string, conversationId: string) => unknown;
showExpiredIncomingTapToViewToast: () => unknown; showExpiredIncomingTapToViewToast: () => unknown;
@ -971,7 +974,7 @@ export class Message extends React.PureComponent<Props, State> {
? undefined ? undefined
: () => { : () => {
scrollToQuotedMessage({ scrollToQuotedMessage({
author: quote.authorId, authorId: quote.authorId,
sentAt: quote.sentAt, sentAt: quote.sentAt,
}); });
}; };

View file

@ -1133,7 +1133,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
bodyRanges: this.processBodyRanges(bodyRanges), bodyRanges: this.processBodyRanges(bodyRanges),
isFromMe, isFromMe,
sentAt, sentAt,
authorId: author, authorId: contact ? contact.id : undefined,
authorPhoneNumber, authorPhoneNumber,
authorProfileName, authorProfileName,
authorTitle, authorTitle,

View file

@ -14817,7 +14817,7 @@
"rule": "React-createRef", "rule": "React-createRef",
"path": "ts/components/conversation/Message.tsx", "path": "ts/components/conversation/Message.tsx",
"line": " public audioRef: React.RefObject<HTMLAudioElement> = React.createRef();", "line": " public audioRef: React.RefObject<HTMLAudioElement> = React.createRef();",
"lineNumber": 223, "lineNumber": 226,
"reasonCategory": "usageTrusted", "reasonCategory": "usageTrusted",
"updated": "2020-09-08T20:19:01.913Z" "updated": "2020-09-08T20:19:01.913Z"
}, },
@ -14825,7 +14825,7 @@
"rule": "React-createRef", "rule": "React-createRef",
"path": "ts/components/conversation/Message.tsx", "path": "ts/components/conversation/Message.tsx",
"line": " public focusRef: React.RefObject<HTMLDivElement> = React.createRef();", "line": " public focusRef: React.RefObject<HTMLDivElement> = React.createRef();",
"lineNumber": 225, "lineNumber": 228,
"reasonCategory": "usageTrusted", "reasonCategory": "usageTrusted",
"updated": "2020-09-08T20:19:01.913Z" "updated": "2020-09-08T20:19:01.913Z"
}, },
@ -14833,7 +14833,7 @@
"rule": "React-createRef", "rule": "React-createRef",
"path": "ts/components/conversation/Message.tsx", "path": "ts/components/conversation/Message.tsx",
"line": " > = React.createRef();", "line": " > = React.createRef();",
"lineNumber": 229, "lineNumber": 232,
"reasonCategory": "usageTrusted", "reasonCategory": "usageTrusted",
"updated": "2020-08-28T19:36:40.817Z" "updated": "2020-08-28T19:36:40.817Z"
}, },

View file

@ -797,7 +797,7 @@ Whisper.ConversationView = Whisper.View.extend({
}; };
const scrollToQuotedMessage = async (options: any) => { const scrollToQuotedMessage = async (options: any) => {
const { author, sentAt } = options; const { authorId, sentAt } = options;
const conversationId = this.model.id; const conversationId = this.model.id;
const messages = await getMessagesBySentAt(sentAt, { const messages = await getMessagesBySentAt(sentAt, {
@ -806,7 +806,8 @@ Whisper.ConversationView = Whisper.View.extend({
const message = messages.find( const message = messages.find(
item => item =>
item.get('conversationId') === conversationId && item.get('conversationId') === conversationId &&
item.getSource() === author authorId &&
item.getContactId() === authorId
); );
if (!message) { if (!message) {