Skip to content

Commit

Permalink
Quotes: Use authorId when navigating to original message
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal authored Dec 11, 2020
1 parent 3715309 commit 0506b79
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
7 changes: 5 additions & 2 deletions ts/components/conversation/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ export type PropsActions = {
displayTapToViewMessage: (messageId: string) => unknown;

openLink: (url: string) => void;
scrollToQuotedMessage: (options: { author: string; sentAt: number }) => void;
scrollToQuotedMessage: (options: {
authorId: string;
sentAt: number;
}) => void;
selectMessage?: (messageId: string, conversationId: string) => unknown;

showExpiredIncomingTapToViewToast: () => unknown;
Expand Down Expand Up @@ -971,7 +974,7 @@ export class Message extends React.PureComponent<Props, State> {
? undefined
: () => {
scrollToQuotedMessage({
author: quote.authorId,
authorId: quote.authorId,
sentAt: quote.sentAt,
});
};
Expand Down
2 changes: 1 addition & 1 deletion ts/models/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
bodyRanges: this.processBodyRanges(bodyRanges),
isFromMe,
sentAt,
authorId: author,
authorId: contact ? contact.id : undefined,
authorPhoneNumber,
authorProfileName,
authorTitle,
Expand Down
6 changes: 3 additions & 3 deletions ts/util/lint/exceptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14817,23 +14817,23 @@
"rule": "React-createRef",
"path": "ts/components/conversation/Message.tsx",
"line": " public audioRef: React.RefObject<HTMLAudioElement> = React.createRef();",
"lineNumber": 223,
"lineNumber": 226,
"reasonCategory": "usageTrusted",
"updated": "2020-09-08T20:19:01.913Z"
},
{
"rule": "React-createRef",
"path": "ts/components/conversation/Message.tsx",
"line": " public focusRef: React.RefObject<HTMLDivElement> = React.createRef();",
"lineNumber": 225,
"lineNumber": 228,
"reasonCategory": "usageTrusted",
"updated": "2020-09-08T20:19:01.913Z"
},
{
"rule": "React-createRef",
"path": "ts/components/conversation/Message.tsx",
"line": " > = React.createRef();",
"lineNumber": 229,
"lineNumber": 232,
"reasonCategory": "usageTrusted",
"updated": "2020-08-28T19:36:40.817Z"
},
Expand Down
5 changes: 3 additions & 2 deletions ts/views/conversation_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ Whisper.ConversationView = Whisper.View.extend({
};

const scrollToQuotedMessage = async (options: any) => {
const { author, sentAt } = options;
const { authorId, sentAt } = options;

const conversationId = this.model.id;
const messages = await getMessagesBySentAt(sentAt, {
Expand All @@ -806,7 +806,8 @@ Whisper.ConversationView = Whisper.View.extend({
const message = messages.find(
item =>
item.get('conversationId') === conversationId &&
item.getSource() === author
authorId &&
item.getContactId() === authorId
);

if (!message) {
Expand Down

0 comments on commit 0506b79

Please sign in to comment.