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:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user