mirror of https://github.com/vector-im/riot-web
MatrixChat: Move the indexing limited room logic to a different event.
parent
e296fd05c0
commit
d911055f5d
|
@ -1276,11 +1276,6 @@ export default createReactClass({
|
|||
// https://github.com/vector-im/riot-web/issues/3307#issuecomment-282895568
|
||||
cli.setCanResetTimelineCallback(async function(roomId) {
|
||||
console.log("Request to reset timeline in room ", roomId, " viewing:", self.state.currentRoomId);
|
||||
// TODO is there a better place to plug this in
|
||||
const eventIndex = EventIndexPeg.get();
|
||||
if (eventIndex !== null) {
|
||||
await eventIndex.addCheckpointForLimitedRoom(roomId);
|
||||
}
|
||||
|
||||
if (roomId !== self.state.currentRoomId) {
|
||||
// It is safe to remove events from rooms we are not viewing.
|
||||
|
@ -1314,6 +1309,13 @@ export default createReactClass({
|
|||
await eventIndex.onEventDecrypted(ev, err);
|
||||
});
|
||||
|
||||
cli.on("Room.timelineReset", async (room, timelineSet, resetAllTimelines) => {
|
||||
const eventIndex = EventIndexPeg.get();
|
||||
if (eventIndex === null) return;
|
||||
if (resetAllTimelines === true) return;
|
||||
await eventIndex.addCheckpointForLimitedRoom(roomId);
|
||||
});
|
||||
|
||||
cli.on('sync', function(state, prevState, data) {
|
||||
// LifecycleStore and others cannot directly subscribe to matrix client for
|
||||
// events because flux only allows store state changes during flux dispatches.
|
||||
|
|
Loading…
Reference in New Issue