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 = [ static ROOM_LIST_SETTINGS = [
'RoomList.orderByRecents', 'RoomList.orderAlphabetically',
'RoomList.orderByImportance', 'RoomList.orderByImportance',
'breadcrumbs', 'breadcrumbs',
]; ];

View file

@ -433,10 +433,11 @@ export const SETTINGS = {
deny: [], deny: [],
}, },
}, },
"RoomList.orderByRecents": { "RoomList.orderAlphabetically": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS, 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, default: true,
invertedSettingName: "RoomList.orderByRecents",
}, },
"RoomList.orderByImportance": { "RoomList.orderByImportance": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,

View file

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