|
|
|
|
@ -8,15 +8,16 @@ Meteor.methods |
|
|
|
|
unless Meteor.call 'canAccessRoom', message.rid, fromId |
|
|
|
|
return false |
|
|
|
|
|
|
|
|
|
if not RocketChat.settings.get 'Message_ShowEditedStatus' |
|
|
|
|
options.fields = { 'editedAt': 0 } |
|
|
|
|
|
|
|
|
|
limit = limit - 1 |
|
|
|
|
|
|
|
|
|
options = |
|
|
|
|
sort: |
|
|
|
|
ts: -1 |
|
|
|
|
limit: Math.ceil(limit/2) |
|
|
|
|
|
|
|
|
|
if not RocketChat.settings.get 'Message_ShowEditedStatus' |
|
|
|
|
options.fields = { 'editedAt': 0 } |
|
|
|
|
|
|
|
|
|
records = RocketChat.models.Messages.findVisibleByRoomIdBeforeTimestamp(message.rid, message.ts, options).fetch() |
|
|
|
|
messages = _.map records, (message) -> |
|
|
|
|
message.starred = _.findWhere message.starred, { _id: fromId } |
|
|
|
|
@ -26,10 +27,9 @@ Meteor.methods |
|
|
|
|
|
|
|
|
|
messages.push message |
|
|
|
|
|
|
|
|
|
options = |
|
|
|
|
sort: |
|
|
|
|
ts: 1 |
|
|
|
|
limit: Math.floor(limit/2) |
|
|
|
|
options.sort = { ts: 1 } |
|
|
|
|
options.limit = Math.floor(limit/2) |
|
|
|
|
|
|
|
|
|
records = RocketChat.models.Messages.findVisibleByRoomIdAfterTimestamp(message.rid, message.ts, options).fetch() |
|
|
|
|
afterMessages = _.map records, (message) -> |
|
|
|
|
message.starred = _.findWhere message.starred, { _id: fromId } |
|
|
|
|
|