From d402808101f77d0319634efe67a7354c0da62308 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 30 Jun 2020 19:31:59 -0600 Subject: [PATCH 1/2] Disable use of account-level ordering options in new room list Fixes https://github.com/vector-im/riot-web/issues/14069 We can't drop them completely for compatibility with the old room list. --- .../tabs/user/PreferencesUserSettingsTab.js | 16 +++++++++++++++- src/settings/Settings.js | 2 ++ src/stores/room-list/RoomListStore2.ts | 9 ++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js index bdb2a9ffc4..592331f897 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js @@ -23,6 +23,7 @@ import SettingsStore from "../../../../../settings/SettingsStore"; import Field from "../../../elements/Field"; import * as sdk from "../../../../.."; import PlatformPeg from "../../../../../PlatformPeg"; +import {RoomListStoreTempProxy} from "../../../../../stores/room-list/RoomListStoreTempProxy"; export default class PreferencesUserSettingsTab extends React.Component { static ROOM_LIST_SETTINGS = [ @@ -31,6 +32,19 @@ export default class PreferencesUserSettingsTab extends React.Component { 'breadcrumbs', ]; + // TODO: Remove temp structures: https://github.com/vector-im/riot-web/issues/14231 + static ROOM_LIST_2_SETTINGS = [ + 'breadcrumbs', + ]; + + // TODO: Remove temp structures: https://github.com/vector-im/riot-web/issues/14231 + static ELIGIBLE_ROOM_LIST_SETTINGS = () => { + if (RoomListStoreTempProxy.isUsingNewStore()) { + return PreferencesUserSettingsTab.ROOM_LIST_2_SETTINGS; + } + return PreferencesUserSettingsTab.ROOM_LIST_SETTINGS; + }; + static COMPOSER_SETTINGS = [ 'MessageComposerInput.autoReplaceEmoji', 'MessageComposerInput.suggestEmoji', @@ -175,7 +189,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
{_t("Room list")} - {this._renderGroup(PreferencesUserSettingsTab.ROOM_LIST_SETTINGS)} + {this._renderGroup(PreferencesUserSettingsTab.ELIGIBLE_ROOM_LIST_SETTINGS())}
diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 820329f6c6..cc45bbb4c7 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -478,11 +478,13 @@ export const SETTINGS = { deny: [], }, }, + // TODO: Remove setting: https://github.com/vector-im/riot-web/issues/14231 "RoomList.orderAlphabetically": { supportedLevels: LEVELS_ACCOUNT_SETTINGS, displayName: _td("Order rooms by name"), default: false, }, + // TODO: Remove setting: https://github.com/vector-im/riot-web/issues/14231 "RoomList.orderByImportance": { supportedLevels: LEVELS_ACCOUNT_SETTINGS, displayName: _td("Show rooms with unread notifications first"), diff --git a/src/stores/room-list/RoomListStore2.ts b/src/stores/room-list/RoomListStore2.ts index 497b8e5530..9edfef654c 100644 --- a/src/stores/room-list/RoomListStore2.ts +++ b/src/stores/room-list/RoomListStore2.ts @@ -50,8 +50,6 @@ export class RoomListStore2 extends AsyncStore { private tagWatcher = new TagWatcher(this); private readonly watchedSettings = [ - 'RoomList.orderAlphabetically', - 'RoomList.orderByImportance', 'feature_custom_tags', ]; @@ -338,11 +336,8 @@ export class RoomListStore2 extends AsyncStore { } private async updateAlgorithmInstances() { - const orderByImportance = SettingsStore.getValue("RoomList.orderByImportance"); - const orderAlphabetically = SettingsStore.getValue("RoomList.orderAlphabetically"); - - const defaultSort = orderAlphabetically ? SortAlgorithm.Alphabetic : SortAlgorithm.Recent; - const defaultOrder = orderByImportance ? ListAlgorithm.Importance : ListAlgorithm.Natural; + const defaultSort = SortAlgorithm.Alphabetic; + const defaultOrder = ListAlgorithm.Natural; for (const tag of Object.keys(this.orderedLists)) { const definedSort = this.getTagSorting(tag); From 0868af650a86bdf956cd25516c2ea47a47c0f68e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 30 Jun 2020 19:37:00 -0600 Subject: [PATCH 2/2] Appease the linter --- .../views/settings/tabs/user/PreferencesUserSettingsTab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js index 592331f897..40b622cf37 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.js @@ -38,7 +38,7 @@ export default class PreferencesUserSettingsTab extends React.Component { ]; // TODO: Remove temp structures: https://github.com/vector-im/riot-web/issues/14231 - static ELIGIBLE_ROOM_LIST_SETTINGS = () => { + static eligibleRoomListSettings = () => { if (RoomListStoreTempProxy.isUsingNewStore()) { return PreferencesUserSettingsTab.ROOM_LIST_2_SETTINGS; } @@ -189,7 +189,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
{_t("Room list")} - {this._renderGroup(PreferencesUserSettingsTab.ELIGIBLE_ROOM_LIST_SETTINGS())} + {this._renderGroup(PreferencesUserSettingsTab.eligibleRoomListSettings())}