[FIX] Messages not being loaded properly (#513)
This commit is contained in:
parent
53014ce022
commit
11e94b9017
|
@ -14,7 +14,7 @@ async function loadMessagesForRoomRest({ rid: roomId, latest, t }) {
|
|||
if (latest) {
|
||||
latest = new Date(latest).toISOString();
|
||||
}
|
||||
const data = await SDK.api.get(`${ types[t] }.history`, { roomId, latest });
|
||||
const data = await SDK.api.get(`${ types[t] }.history`, { roomId, latest, count: 50 });
|
||||
if (!data || data.status === 'error') {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ async function loadMissedMessagesRest({ rid: roomId, lastOpen }) {
|
|||
if (lastOpen) {
|
||||
lastUpdate = new Date(lastOpen).toISOString();
|
||||
}
|
||||
const { result } = await SDK.api.get('chat.syncMessages', { roomId, lastUpdate });
|
||||
const { result } = await SDK.api.get('chat.syncMessages', { roomId, lastUpdate, count: 50 });
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ async function loadMissedMessagesDDP(...args) {
|
|||
const [{ rid, lastOpen: lastUpdate }] = args;
|
||||
|
||||
try {
|
||||
const result = await SDK.driver.asyncCall('messages/get', rid, { lastUpdate: new Date(lastUpdate) });
|
||||
const result = await SDK.driver.asyncCall('messages/get', rid, { lastUpdate: new Date(lastUpdate), count: 50 });
|
||||
return result;
|
||||
} catch (e) {
|
||||
return loadMissedMessagesRest.call(this, ...args);
|
||||
|
|
|
@ -162,7 +162,7 @@ export default class RoomView extends LoggedView {
|
|||
const { room } = this.state;
|
||||
try {
|
||||
const result = await RocketChat.loadMessagesForRoom({ rid: this.rid, t: room.t, latest: lastRowData.ts });
|
||||
this.internalSetState({ end: result < 20 });
|
||||
this.internalSetState({ end: result < 50 });
|
||||
} catch (e) {
|
||||
log('RoomView.onEndReached', e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue