MatrixChat: Move the indexing limited room logic to a different event.
This commit is contained in:
parent
e296fd05c0
commit
d911055f5d
1 changed files with 7 additions and 5 deletions
|
@ -1276,11 +1276,6 @@ export default createReactClass({
|
||||||
// https://github.com/vector-im/riot-web/issues/3307#issuecomment-282895568
|
// https://github.com/vector-im/riot-web/issues/3307#issuecomment-282895568
|
||||||
cli.setCanResetTimelineCallback(async function(roomId) {
|
cli.setCanResetTimelineCallback(async function(roomId) {
|
||||||
console.log("Request to reset timeline in room ", roomId, " viewing:", self.state.currentRoomId);
|
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) {
|
if (roomId !== self.state.currentRoomId) {
|
||||||
// It is safe to remove events from rooms we are not viewing.
|
// It is safe to remove events from rooms we are not viewing.
|
||||||
|
@ -1314,6 +1309,13 @@ export default createReactClass({
|
||||||
await eventIndex.onEventDecrypted(ev, err);
|
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) {
|
cli.on('sync', function(state, prevState, data) {
|
||||||
// LifecycleStore and others cannot directly subscribe to matrix client for
|
// LifecycleStore and others cannot directly subscribe to matrix client for
|
||||||
// events because flux only allows store state changes during flux dispatches.
|
// events because flux only allows store state changes during flux dispatches.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue