MessageView: Add id from database to DOM for outgoing messages (#2350)

This commit is contained in:
Scott Nonnenberg 2018-05-07 19:08:45 -07:00 committed by GitHub
parent b41cf47df6
commit b6a585a646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -313,6 +313,7 @@
onChange() {
this.renderSent();
this.renderQuote();
this.addId();
},
select(e) {
this.$el.trigger('select', { message: this.model });
@ -470,6 +471,13 @@
return body || isGroupUpdate || isEndSession || errorsCanBeContents;
},
addId() {
// Because we initially render a sent Message before we've roundtripped with the
// database, we don't have its id for that first render. We do get a change event,
// however, and can add the id manually.
const { id } = this.model;
this.$el.attr('id', id);
},
render() {
const contact = this.model.isIncoming() ? this.model.getContact() : null;
const attachments = this.model.get('attachments');