Skip to content

Commit

Permalink
fix messages date and messages order by date. #1272
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Oct 5, 2016
1 parent 3447418 commit 45a0e78
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions app/modules/messages/views/ReadMessageView.js
@@ -1,11 +1,12 @@
define([
'app',
'underscore',
'backbone',
'handlebars',
'moment',
'core/BasePageView'
],
function(app, Backbone, Handlebars, moment, BasePageView) {
function(app, _, Backbone, Handlebars, moment, BasePageView) {


var ReadView = Backbone.Layout.extend({
Expand Down Expand Up @@ -61,17 +62,14 @@ function(app, Backbone, Handlebars, moment, BasePageView) {

serialize: function() {
var data = this.model.toJSON();
data.datetime += ' UTC';
data.recipients = data.recipients.split(',');
data.recipientsCount = data.recipients.length;
data.collapseRecipients = data.recipients.length > this.maxRecipients;
data.current_user = app.authenticatedUserId;

_.each(data.responses, function(data) {
data.datetime += ' UTC';
});

data.responses = data.responses.reverse();
data.responses = _.sortBy(data.responses, function(response) {
return new Date(response.datetime);
}).reverse();

var title = data.message;
var offset = 0;
Expand Down

0 comments on commit 45a0e78

Please sign in to comment.