Room list: assign room to section when section is created (#33240)

* feat(rls): return section tag when created

* feat(vm): assign section tag to room when section created

* test: update exisiting tests

* test(e2e): check that room is in section
This commit is contained in:
Florian Duros
2026-04-23 10:18:02 +00:00
committed by GitHub
parent bb4a7e9613
commit 546083bca9
7 changed files with 44 additions and 27 deletions
@@ -491,10 +491,11 @@ export class RoomListStoreV3Class extends AsyncStoreWithClient<EmptyObject> {
* Create a new section.
* Emits {@link SECTION_CREATED_EVENT} if the section was successfully created.
*/
public async createSection(): Promise<void> {
public async createSection(): Promise<string | undefined> {
const tag = await createSection();
if (!tag) return;
this.emit(SECTION_CREATED_EVENT, tag);
return tag;
}
/**
@@ -400,8 +400,12 @@ export class RoomListItemViewModel
echoChamber.notificationVolume = elementNotifState;
};
public onCreateSection = (): void => {
RoomListStoreV3.instance.createSection();
public onCreateSection = async (): Promise<void> => {
const newTag = await RoomListStoreV3.instance.createSection();
// Add the room to the section
if (newTag) {
tagRoom(this.props.room, newTag);
}
};
public onToggleSection = (tag: string): void => {