Skip to content

Commit

Permalink
Message Detail: Ensure that quotes are not clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Mar 13, 2019
1 parent 601ad37 commit 768007a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
25 changes: 14 additions & 11 deletions js/models/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
snippet: this.get('snippet'),
};
},
getPropsForMessage() {
getPropsForMessage(options) {
const phoneNumber = this.getSource();
const contact = this.findAndFormatContact(phoneNumber);
const contactModel = this.findContact(phoneNumber);
Expand Down Expand Up @@ -491,7 +491,7 @@
.filter(attachment => !attachment.error)
.map(attachment => this.getPropsForAttachment(attachment)),
previews: this.getPropsForPreview(),
quote: this.getPropsForQuote(),
quote: this.getPropsForQuote(options),
authorAvatarPath,
isExpired: this.hasExpired,
expirationLength,
Expand Down Expand Up @@ -601,7 +601,8 @@
image: preview.image ? this.getPropsForAttachment(preview.image) : null,
}));
},
getPropsForQuote() {
getPropsForQuote(options = {}) {
const { noClick } = options;
const quote = this.get('quote');
if (!quote) {
return null;
Expand All @@ -620,13 +621,15 @@
const authorProfileName = contact ? contact.getProfileName() : null;
const authorName = contact ? contact.getName() : null;
const isFromMe = contact ? contact.id === this.OUR_NUMBER : false;
const onClick = () => {
this.trigger('scroll-to-message', {
author,
id,
referencedMessageNotFound,
});
};
const onClick = noClick
? null
: () => {
this.trigger('scroll-to-message', {
author,
id,
referencedMessageNotFound,
});
};

const firstAttachment = quote.attachments && quote.attachments[0];

Expand Down Expand Up @@ -753,7 +756,7 @@
sentAt: this.get('sent_at'),
receivedAt: this.get('received_at'),
message: {
...this.getPropsForMessage(),
...this.getPropsForMessage({ noClick: true }),
disableMenu: true,
// To ensure that group avatar doesn't show up
conversationType: 'direct',
Expand Down
4 changes: 2 additions & 2 deletions ts/util/lint/exceptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@
"rule": "jQuery-wrap(",
"path": "js/models/messages.js",
"line": " return this.send(wrap(promise));",
"lineNumber": 935,
"lineNumber": 938,
"reasonCategory": "falseMatch",
"updated": "2018-10-05T23:12:28.961Z"
},
{
"rule": "jQuery-wrap(",
"path": "js/models/messages.js",
"line": " return wrap(",
"lineNumber": 1182,
"lineNumber": 1185,
"reasonCategory": "falseMatch",
"updated": "2018-10-05T23:12:28.961Z"
},
Expand Down

0 comments on commit 768007a

Please sign in to comment.