Merge branch 'hotfix/21.56.9' into master
[gitter.git] / public / js / views / behaviors / last-message-seen.js
blobf86e12aa1c9241317de064097ed3448291f30938
1 'use strict';
2 var Marionette = require('backbone.marionette');
3 var behaviourLookup = require('./lookup');
5 module.exports = (function() {
6   var Behavior = Marionette.Behavior.extend({
7     modelEvents: {
8       'change:lastMessageSeen': 'onRender'
9     },
11     onRender: function() {
12       if (!this.view.model) return;
13       if (!this.view.model.get('lastMessageSeen')) return;
15       this.view.$el.addClass('lastMessageSeen');
16     }
17   });
19   behaviourLookup.register('LastMessageSeen', Behavior);
20   return Behavior;
21 })();