|
|
|
|
@ -51,11 +51,12 @@ export const RoomHistoryManager = new class { |
|
|
|
|
typeName = (curRoomDoc != null ? curRoomDoc.t : undefined) + (curRoomDoc != null ? curRoomDoc.name : undefined); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Meteor.call('loadHistory', rid, ts, limit, ls, function(err, result) { |
|
|
|
|
Meteor.call('loadHistory', rid, ts, limit, ls, function(err, result) { |
|
|
|
|
if (err) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
let previousHeight; |
|
|
|
|
const {messages = []} = result; |
|
|
|
|
room.unreadNotLoaded.set(result.unreadNotLoaded); |
|
|
|
|
room.firstUnread.set(result.firstUnread); |
|
|
|
|
|
|
|
|
|
@ -64,7 +65,7 @@ export const RoomHistoryManager = new class { |
|
|
|
|
previousHeight = wrapper.scrollHeight; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
result.messages.forEach(item => { |
|
|
|
|
messages.forEach(item => { |
|
|
|
|
if (item.t !== 'command') { |
|
|
|
|
const roles = [ |
|
|
|
|
(item.u && item.u._id && UserRoles.findOne(item.u._id, { fields: { roles: 1 }})) || {}, |
|
|
|
|
@ -87,8 +88,8 @@ export const RoomHistoryManager = new class { |
|
|
|
|
|
|
|
|
|
room.isLoading.set(false); |
|
|
|
|
if (room.loaded == null) { room.loaded = 0; } |
|
|
|
|
room.loaded += result.messages.length; |
|
|
|
|
if (result.messages.length < limit) { |
|
|
|
|
room.loaded += messages.length; |
|
|
|
|
if (messages.length < limit) { |
|
|
|
|
return room.hasMore.set(false); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|