Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Make the text filter search all spaces instead of just the selected one #5942

Merged
merged 3 commits into from
Apr 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/stores/room-list/RoomListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,11 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {

let rooms = this.matrixClient.getVisibleRooms().filter(r => VisibilityProvider.instance.isRoomVisible(r));

if (this.prefilterConditions.length > 0) {
// if spaces are enabled only consider the prefilter conditions when there are no runtime conditions
// for the search all spaces feature
if (this.prefilterConditions.length > 0
&& (!SettingsStore.getValue("feature_spaces") || !this.filterConditions.length)
) {
rooms = rooms.filter(r => {
for (const filter of this.prefilterConditions) {
if (!filter.isVisible(r)) {
Expand Down Expand Up @@ -675,6 +679,10 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
if (this.algorithm) {
this.algorithm.addFilterCondition(filter);
}
// Runtime filters with spaces disable prefiltering for the search all spaces effect
if (SettingsStore.getValue("feature_spaces")) {
promise = this.recalculatePrefiltering();
}
}
promise.then(() => this.updateFn.trigger());
}
Expand All @@ -698,6 +706,10 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {

if (this.algorithm) {
this.algorithm.removeFilterCondition(filter);
// Runtime filters with spaces disable prefiltering for the search all spaces effect
if (SettingsStore.getValue("feature_spaces")) {
promise = this.recalculatePrefiltering();
}
}
}
idx = this.prefilterConditions.indexOf(filter);
Expand Down