You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Fix issue where no unsubs are sent when switching rooms
This commit is contained in:
@@ -397,6 +397,10 @@ export class SlidingSync extends TypedEventEmitter<SlidingSyncEvent, SlidingSync
|
||||
* @param sub - The subscription information.
|
||||
*/
|
||||
public addCustomSubscription(name: string, sub: MSC3575RoomSubscription): void {
|
||||
if (this.customSubscriptions.get(name) !== undefined) {
|
||||
logger.warn(`addCustomSubscription: ${name} already exists as a custom subscription, ignoring.`);
|
||||
return;
|
||||
}
|
||||
this.customSubscriptions.set(name, sub);
|
||||
}
|
||||
|
||||
@@ -408,6 +412,11 @@ export class SlidingSync extends TypedEventEmitter<SlidingSyncEvent, SlidingSync
|
||||
* will be used.
|
||||
*/
|
||||
public useCustomSubscription(roomId: string, name: string): void {
|
||||
// We already know about this custom subscription, as it is immutable,
|
||||
// we don't need to unconfirm the subscription.
|
||||
if (this.roomIdToCustomSubscription.get(roomId) === name) {
|
||||
return;
|
||||
}
|
||||
this.roomIdToCustomSubscription.set(roomId, name);
|
||||
// unconfirm this subscription so a resend() will send it up afresh.
|
||||
this.confirmedRoomSubscriptions.delete(roomId);
|
||||
|
||||
Reference in New Issue
Block a user