Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sync init when thread unread notif is not supported #2739

Merged
merged 10 commits into from
Oct 7, 2022
3 changes: 2 additions & 1 deletion spec/unit/filter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { UNREAD_THREAD_NOTIFICATIONS } from "../../src/@types/sync";
import { Filter, IFilterDefinition } from "../../src/filter";

describe("Filter", function() {
Expand Down Expand Up @@ -50,7 +51,7 @@ describe("Filter", function() {
expect(filter.getDefinition()).toEqual({
room: {
timeline: {
unread_thread_notifications: true,
[UNREAD_THREAD_NOTIFICATIONS.name]: true,
},
},
});
Expand Down
12 changes: 11 additions & 1 deletion src/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
EventType,
RelationType,
} from "./@types/event";
import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync";
import { FilterComponent, IFilterComponent } from "./filter-component";
import { MatrixEvent } from "./models/event";

Expand Down Expand Up @@ -227,7 +228,16 @@ export class Filter {
* @param {boolean} enabled
*/
public setUnreadThreadNotifications(enabled: boolean): void {
setProp(this.definition, "room.timeline.unread_thread_notifications", !!enabled);
this.definition = {
...this.definition,
room: {
...this.definition?.room,
timeline: {
...this.definition?.room?.timeline,
[UNREAD_THREAD_NOTIFICATIONS.name]: !!enabled,
germain-gg marked this conversation as resolved.
Show resolved Hide resolved
},
},
};
}

setLazyLoadMembers(enabled: boolean): void {
Expand Down