Skip to content

Commit

Permalink
Merge pull request #4866 from matrix-org/travis/room-list/rm-ordering…
Browse files Browse the repository at this point in the history
…-options

Disable use of account-level ordering options in new room list
  • Loading branch information
turt2live committed Jul 1, 2020
2 parents a78728a + 0868af6 commit fed0c32
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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 eligibleRoomListSettings = () => {
if (RoomListStoreTempProxy.isUsingNewStore()) {
return PreferencesUserSettingsTab.ROOM_LIST_2_SETTINGS;
}
return PreferencesUserSettingsTab.ROOM_LIST_SETTINGS;
};

static COMPOSER_SETTINGS = [
'MessageComposerInput.autoReplaceEmoji',
'MessageComposerInput.suggestEmoji',
Expand Down Expand Up @@ -175,7 +189,7 @@ export default class PreferencesUserSettingsTab extends React.Component {

<div className="mx_SettingsTab_section">
<span className="mx_SettingsTab_subheading">{_t("Room list")}</span>
{this._renderGroup(PreferencesUserSettingsTab.ROOM_LIST_SETTINGS)}
{this._renderGroup(PreferencesUserSettingsTab.eligibleRoomListSettings())}
</div>

<div className="mx_SettingsTab_section">
Expand Down
2 changes: 2 additions & 0 deletions src/settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
9 changes: 2 additions & 7 deletions src/stores/room-list/RoomListStore2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
private tagWatcher = new TagWatcher(this);

private readonly watchedSettings = [
'RoomList.orderAlphabetically',
'RoomList.orderByImportance',
'feature_custom_tags',
];

Expand Down Expand Up @@ -338,11 +336,8 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
}

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);
Expand Down

0 comments on commit fed0c32

Please sign in to comment.