Merge pull request #4881 from matrix-org/travis/room-list/enable-default
Enable the new room list by default and trigger an initial renderpull/21833/head
commit
cc23f23f19
|
@ -166,19 +166,26 @@ export default class RoomList2 extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidMount(): void {
|
public componentDidMount(): void {
|
||||||
RoomListStore.instance.on(LISTS_UPDATE_EVENT, (store: RoomListStore2) => {
|
RoomListStore.instance.on(LISTS_UPDATE_EVENT, this.updateLists);
|
||||||
const newLists = store.orderedLists;
|
this.updateLists(); // trigger the first update
|
||||||
console.log("new lists", newLists);
|
|
||||||
|
|
||||||
const layoutMap = new Map<TagID, ListLayout>();
|
|
||||||
for (const tagId of Object.keys(newLists)) {
|
|
||||||
layoutMap.set(tagId, new ListLayout(tagId));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({sublists: newLists, layouts: layoutMap});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public componentWillUnmount() {
|
||||||
|
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this.updateLists);
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateLists = () => {
|
||||||
|
const newLists = RoomListStore.instance.orderedLists;
|
||||||
|
console.log("new lists", newLists);
|
||||||
|
|
||||||
|
const layoutMap = new Map<TagID, ListLayout>();
|
||||||
|
for (const tagId of Object.keys(newLists)) {
|
||||||
|
layoutMap.set(tagId, new ListLayout(tagId));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({sublists: newLists, layouts: layoutMap});
|
||||||
|
};
|
||||||
|
|
||||||
private renderCommunityInvites(): React.ReactElement[] {
|
private renderCommunityInvites(): React.ReactElement[] {
|
||||||
// TODO: Put community invites in a more sensible place (not in the room list)
|
// TODO: Put community invites in a more sensible place (not in the room list)
|
||||||
return MatrixClientPeg.get().getGroups().filter(g => {
|
return MatrixClientPeg.get().getGroups().filter(g => {
|
||||||
|
|
|
@ -150,7 +150,7 @@ export const SETTINGS = {
|
||||||
isFeature: true,
|
isFeature: true,
|
||||||
displayName: _td("Use the improved room list (will refresh to apply changes)"),
|
displayName: _td("Use the improved room list (will refresh to apply changes)"),
|
||||||
supportedLevels: LEVELS_FEATURE,
|
supportedLevels: LEVELS_FEATURE,
|
||||||
default: false,
|
default: true,
|
||||||
controller: new ReloadOnChangeController(),
|
controller: new ReloadOnChangeController(),
|
||||||
},
|
},
|
||||||
"feature_custom_themes": {
|
"feature_custom_themes": {
|
||||||
|
|
Loading…
Reference in New Issue