2018-07-07 00:48:14 +00:00
|
|
|
/* global Backbone, Whisper */
|
|
|
|
|
|
|
|
// eslint-disable-next-line func-names
|
2018-04-27 21:25:04 +00:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
2015-01-09 22:53:39 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
window.Whisper = window.Whisper || {};
|
2015-01-09 22:53:39 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
Whisper.GroupUpdateView = Backbone.View.extend({
|
|
|
|
tagName: 'div',
|
|
|
|
className: 'group-update',
|
2018-07-07 00:48:14 +00:00
|
|
|
render() {
|
|
|
|
// TODO l10n
|
2018-04-27 21:25:04 +00:00
|
|
|
if (this.model.left) {
|
2018-07-07 00:48:14 +00:00
|
|
|
this.$el.text(`${this.model.left} left the group`);
|
2018-04-27 21:25:04 +00:00
|
|
|
return this;
|
|
|
|
}
|
2015-02-16 20:47:36 +00:00
|
|
|
|
2018-07-07 00:48:14 +00:00
|
|
|
const messages = ['Updated the group.'];
|
2018-04-27 21:25:04 +00:00
|
|
|
if (this.model.name) {
|
2018-07-07 00:48:14 +00:00
|
|
|
messages.push(`Title is now '${this.model.name}'.`);
|
2018-04-27 21:25:04 +00:00
|
|
|
}
|
|
|
|
if (this.model.joined) {
|
2018-07-07 00:48:14 +00:00
|
|
|
messages.push(`${this.model.joined.join(', ')} joined the group`);
|
2018-04-27 21:25:04 +00:00
|
|
|
}
|
2015-01-09 22:53:39 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
this.$el.text(messages.join(' '));
|
2015-01-09 22:53:39 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
});
|
2015-01-09 22:53:39 +00:00
|
|
|
})();
|