Switch all-rooms toggle for spaces to non-feature settings key

pull/21833/head
Michael Telatynski 2021-07-27 21:17:24 +01:00
parent 0a9d3302ba
commit 776435f620
6 changed files with 13 additions and 14 deletions

View File

@ -797,7 +797,6 @@
"You can leave the beta any time from settings or tapping on a beta badge, like the one above.": "You can leave the beta any time from settings or tapping on a beta badge, like the one above.",
"Beta available for web, desktop and Android. Some features may be unavailable on your homeserver.": "Beta available for web, desktop and Android. Some features may be unavailable on your homeserver.",
"Your feedback will help make spaces better. The more detail you can go into, the better.": "Your feedback will help make spaces better. The more detail you can go into, the better.",
"Show all rooms in Home": "Show all rooms in Home",
"Show options to enable 'Do not disturb' mode": "Show options to enable 'Do not disturb' mode",
"Send and receive voice messages": "Send and receive voice messages",
"Render LaTeX maths in messages": "Render LaTeX maths in messages",
@ -868,6 +867,7 @@
"Manually verify all remote sessions": "Manually verify all remote sessions",
"IRC display name width": "IRC display name width",
"Show chat effects (animations when receiving e.g. confetti)": "Show chat effects (animations when receiving e.g. confetti)",
"Show all rooms in Home": "Show all rooms in Home",
"Collecting app version information": "Collecting app version information",
"Collecting logs": "Collecting logs",
"Uploading logs": "Uploading logs",

View File

@ -180,15 +180,10 @@ export const SETTINGS: {[setting: string]: ISetting} = {
"The more detail you can go into, the better."),
feedbackLabel: "spaces-feedback",
extraSettings: [
"feature_spaces.all_rooms",
"Spaces.all_rooms_in_home",
],
},
},
"feature_spaces.all_rooms": {
displayName: _td("Show all rooms in Home"),
supportedLevels: LEVELS_FEATURE,
default: false,
},
"feature_dnd": {
isFeature: true,
displayName: _td("Show options to enable 'Do not disturb' mode"),
@ -756,6 +751,11 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
default: null,
},
"Spaces.all_rooms_in_home": {
displayName: _td("Show all rooms in Home"),
supportedLevels: LEVELS_FEATURE,
default: false,
},
[UIFeature.RoomHistorySettings]: {
supportedLevels: LEVELS_UI_FEATURE,
default: true,

View File

@ -117,12 +117,12 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
private _invitedSpaces = new Set<Room>();
private spaceOrderLocalEchoMap = new Map<string, string>();
private _restrictedJoinRuleSupport?: IRoomCapability;
private _allRoomsInHome: boolean = SettingsStore.getValue("feature_spaces.all_rooms");
private _allRoomsInHome: boolean = SettingsStore.getValue("Spaces.all_rooms_in_home");
constructor() {
super(defaultDispatcher, {});
SettingsStore.monitorSetting("feature_spaces.all_rooms", null);
SettingsStore.monitorSetting("Spaces.all_rooms_in_home", null);
}
public get invitedSpaces(): Room[] {
@ -812,8 +812,8 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
case Action.SettingUpdated: {
const settingUpdatedPayload = payload as SettingUpdatedPayload;
if (settingUpdatedPayload.settingName === "feature_spaces.all_rooms") {
const newValue = SettingsStore.getValue("feature_spaces.all_rooms");
if (settingUpdatedPayload.settingName === "Spaces.all_rooms_in_home") {
const newValue = SettingsStore.getValue("Spaces.all_rooms_in_home");
if (this.allRoomsInHome !== newValue) {
this._allRoomsInHome = newValue;
this.emit(UPDATE_HOME_BEHAVIOUR, this.allRoomsInHome);

View File

@ -18,4 +18,3 @@ limitations under the License.
// SpaceStore reads the SettingsStore which needs the localStorage values set at init time.
localStorage.setItem("mx_labs_feature_feature_spaces", "true");
localStorage.setItem("mx_labs_feature_feature_spaces.all_rooms", "true");

View File

@ -85,7 +85,7 @@ describe("SpaceStore", () => {
const setShowAllRooms = async (value: boolean) => {
if (store.allRoomsInHome === value) return;
const emitProm = testUtils.emitPromise(store, UPDATE_HOME_BEHAVIOUR);
await SettingsStore.setValue("feature_spaces.all_rooms", null, SettingLevel.DEVICE, value);
await SettingsStore.setValue("Spaces.all_rooms_in_home", null, SettingLevel.DEVICE, value);
jest.runAllTimers(); // run async dispatch
await emitProm;
};

View File

@ -47,7 +47,7 @@ describe("SpaceWatcher", () => {
const setShowAllRooms = async (value: boolean) => {
if (store.allRoomsInHome === value) return;
await SettingsStore.setValue("feature_spaces.all_rooms", null, SettingLevel.DEVICE, value);
await SettingsStore.setValue("Spaces.all_rooms_in_home", null, SettingLevel.DEVICE, value);
await testUtils.emitPromise(store, UPDATE_HOME_BEHAVIOUR);
};