Use RoomList.orderAlphabetically as the inverse of RoomList.orderByRecents for migration

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-02-26 23:05:08 +00:00
parent a1908a208e
commit 3ad8b6e9cc
3 changed files with 9 additions and 8 deletions

View file

@ -48,7 +48,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
];
static ROOM_LIST_SETTINGS = [
'RoomList.orderByRecents',
'RoomList.orderAlphabetically',
'RoomList.orderByImportance',
'breadcrumbs',
];

View file

@ -433,10 +433,11 @@ export const SETTINGS = {
deny: [],
},
},
"RoomList.orderByRecents": {
"RoomList.orderAlphabetically": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Order rooms by message activity instead of by name"),
displayName: _td("Order rooms alphabetically by name instead of by recent activity"),
default: true,
invertedSettingName: "RoomList.orderByRecents",
},
"RoomList.orderByImportance": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,

View file

@ -133,8 +133,8 @@ class RoomListStore extends Store {
orderImportantFirst: false,
};
SettingsStore.monitorSetting('RoomList.orderAlphabetically', null);
SettingsStore.monitorSetting('RoomList.orderByImportance', null);
SettingsStore.monitorSetting('RoomList.orderByRecents', null);
SettingsStore.monitorSetting('feature_custom_tags', null);
}
@ -161,8 +161,8 @@ class RoomListStore extends Store {
if (!logicallyReady) break;
switch (payload.settingName) {
case "RoomList.orderByRecents":
this.updateSortingAlgorithm(payload.newValue ? ALGO_RECENT : ALGO_ALPHABETIC,
case "RoomList.orderAlphabetically":
this.updateSortingAlgorithm(payload.newValue ? ALGO_ALPHABETIC : ALGO_RECENT,
this._state.orderImportantFirst);
break;
case "RoomList.orderByImportance":
@ -189,9 +189,9 @@ class RoomListStore extends Store {
this._matrixClient = payload.matrixClient;
const orderByRecents = SettingsStore.getValue("RoomList.orderByRecents");
const orderByImportance = SettingsStore.getValue("RoomList.orderByImportance");
this.updateSortingAlgorithm(orderByRecents ? ALGO_RECENT : ALGO_ALPHABETIC, orderByImportance);
const orderAlphabetically = SettingsStore.getValue("RoomList.orderAlphabetically");
this.updateSortingAlgorithm(orderAlphabetically ? ALGO_ALPHABETIC : ALGO_RECENT, orderByImportance);
}
break;
case 'MatrixActions.Room.receipt': {