Fix various update bugs
This commit is contained in:
parent
956b4a9b96
commit
0f2d1ae2cc
1 changed files with 17 additions and 13 deletions
|
@ -128,11 +128,9 @@ export class Sync3 {
|
||||||
this.status = new ObservableValue(SyncStatus.Stopped);
|
this.status = new ObservableValue(SyncStatus.Stopped);
|
||||||
this.error = null;
|
this.error = null;
|
||||||
// Hydrogen only has 1 list currently (no DM section) so we only need 1 range
|
// Hydrogen only has 1 list currently (no DM section) so we only need 1 range
|
||||||
this.ranges = [[0, 99]];
|
this.ranges = [[0, 49]];
|
||||||
this.roomIndexToRoomId = {};
|
this.roomIndexToRoomId = {};
|
||||||
this.roomIdToRoomIndex = {};
|
this.roomIdToRoomIndex = {};
|
||||||
console.log("session", session);
|
|
||||||
console.log("storage", storage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start syncing. Probably call this at startup once you have an access_token.
|
// Start syncing. Probably call this at startup once you have an access_token.
|
||||||
|
@ -271,6 +269,7 @@ export class Sync3 {
|
||||||
};
|
};
|
||||||
// inject a fake m.room.name event if there isn't a real m.room.name event there already
|
// inject a fake m.room.name event if there isn't a real m.room.name event there already
|
||||||
roomResponse.required_state = roomResponse.required_state || [];
|
roomResponse.required_state = roomResponse.required_state || [];
|
||||||
|
if (roomResponse.name) {
|
||||||
roomResponse.required_state.push({
|
roomResponse.required_state.push({
|
||||||
event_id: "$name" + roomResponse.room_id,
|
event_id: "$name" + roomResponse.room_id,
|
||||||
content: {
|
content: {
|
||||||
|
@ -281,6 +280,7 @@ export class Sync3 {
|
||||||
sender: "@noone",
|
sender: "@noone",
|
||||||
room_id: roomResponse.room_id,
|
room_id: roomResponse.room_id,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const roomv2Response = {
|
const roomv2Response = {
|
||||||
timeline: {
|
timeline: {
|
||||||
|
@ -318,7 +318,11 @@ export class Sync3 {
|
||||||
}
|
}
|
||||||
await syncTxn.complete(log);
|
await syncTxn.complete(log);
|
||||||
|
|
||||||
|
// Sync v3 specific
|
||||||
// atomically move all the rooms to their new positions
|
// atomically move all the rooms to their new positions
|
||||||
|
// We need to do this BEFORE calling afterSync as that causes the room list to be sorted
|
||||||
|
// which eventually causes Sync3.compare to be called, so we need it to be using the latest
|
||||||
|
// sort positions by that point in time.
|
||||||
this.roomIndexToRoomId = indexToRoom;
|
this.roomIndexToRoomId = indexToRoom;
|
||||||
this.roomIdToRoomIndex = {};
|
this.roomIdToRoomIndex = {};
|
||||||
Object.keys(indexToRoom).forEach((indexStr) => {
|
Object.keys(indexToRoom).forEach((indexStr) => {
|
||||||
|
|
Reference in a new issue