1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-21 16:55:10 -05:00

Fix: Messages group: the same day, within 5 minutes

This commit is contained in:
Sebastien Hut 2015-01-26 17:54:47 +01:00
parent d5886c7507
commit 9e06b50fd3
3 changed files with 4 additions and 4 deletions

View File

@ -238,9 +238,9 @@ var Message = module.exports = HumanModel.define({
},
shouldGroupWith: function (previous) {
if (this.type === 'groupchat') {
return previous && previous.from.full === this.from.full;
return previous && previous.from.full === this.from.full && Math.round((this.created - previous.created) / 1000) <= 300 && previous.created.toLocaleDateString() === this.created.toLocaleDateString();
} else {
return previous && previous.from.bare === this.from.bare;
return previous && previous.from.bare === this.from.bare && Math.round((this.created - previous.created) / 1000) <= 300 && previous.created.toLocaleDateString() === this.created.toLocaleDateString();
}
}
});

View File

@ -231,9 +231,9 @@ module.exports = BasePage.extend({
} else {
newEl = $(model.templateHtml);
this.staydown.append(newEl[0]);
this.lastModel = model;
}
embedIt(newEl);
this.lastModel = model;
},
handleAcceptClick: function (e) {
e.preventDefault();

View File

@ -252,9 +252,9 @@ module.exports = BasePage.extend({
} else {
newEl = $(model.templateHtml);
this.staydown.append(newEl[0]);
this.lastModel = model;
}
embedIt(newEl);
this.lastModel = model;
},
refreshModel: function (model) {
var existing = this.$('#chat' + model.cid);