Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into joriks/eslint-config

This commit is contained in:
Jorik Schellekens
2020-07-20 16:22:32 +01:00
454 changed files with 13522 additions and 17619 deletions

View File

@@ -103,12 +103,6 @@ export const SETTINGS = {
supportedLevels: LEVELS_FEATURE,
default: false,
},
"feature_font_scaling": {
isFeature: true,
displayName: _td("Font scaling"),
supportedLevels: LEVELS_FEATURE,
default: false,
},
"feature_pinning": {
isFeature: true,
displayName: _td("Message Pinning"),
@@ -146,24 +140,17 @@ export const SETTINGS = {
supportedLevels: LEVELS_FEATURE,
default: false,
},
"feature_new_room_list": {
isFeature: true,
displayName: _td("Use the improved room list (will refresh to apply changes)"),
supportedLevels: LEVELS_FEATURE,
default: false,
controller: new ReloadOnChangeController(),
},
"feature_custom_themes": {
isFeature: true,
displayName: _td("Support adding custom themes"),
supportedLevels: LEVELS_FEATURE,
default: false,
},
"feature_irc_ui": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Enable IRC layout option in the appearance tab'),
"advancedRoomListLogging": {
// TODO: Remove flag before launch: https://github.com/vector-im/riot-web/issues/14231
displayName: _td("Enable advanced debugging for the room list"),
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
default: false,
isFeature: true,
},
"mjolnirRooms": {
supportedLevels: ['account'],
@@ -202,7 +189,7 @@ export const SETTINGS = {
default: false,
},
"useCompactLayout": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
displayName: _td('Use a more compact Modern layout'),
default: false,
},
@@ -362,6 +349,12 @@ export const SETTINGS = {
default: "en",
},
"breadcrumb_rooms": {
// not really a setting
supportedLevels: ['account'],
default: [],
},
"recent_emoji": {
// not really a setting
supportedLevels: ['account'],
default: [],
},
@@ -478,11 +471,13 @@ export const SETTINGS = {
deny: [],
},
},
// TODO: Remove setting: https://github.com/vector-im/riot-web/issues/14373
"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/14373
"RoomList.orderByImportance": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Show rooms with unread notifications first"),
@@ -572,7 +567,7 @@ export const SETTINGS = {
},
"useIRCLayout": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Use IRC layout"),
displayName: _td("Enable experimental, compact IRC style layout"),
default: false,
},
};

View File

@@ -23,6 +23,7 @@ import {objectClone, objectKeyChanges} from "../../utils/objects";
const BREADCRUMBS_LEGACY_EVENT_TYPE = "im.vector.riot.breadcrumb_rooms";
const BREADCRUMBS_EVENT_TYPE = "im.vector.setting.breadcrumbs";
const BREADCRUMBS_EVENT_TYPES = [BREADCRUMBS_LEGACY_EVENT_TYPE, BREADCRUMBS_EVENT_TYPE];
const RECENT_EMOJI_EVENT_TYPE = "io.element.recent_emoji";
const INTEG_PROVISIONING_EVENT_TYPE = "im.vector.setting.integration_provisioning";
@@ -69,6 +70,9 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
} else if (event.getType() === INTEG_PROVISIONING_EVENT_TYPE) {
const val = event.getContent()['enabled'];
this._watchers.notifyUpdate("integrationProvisioning", null, SettingLevel.ACCOUNT, val);
} else if (event.getType() === RECENT_EMOJI_EVENT_TYPE) {
const val = event.getContent()['enabled'];
this._watchers.notifyUpdate("recent_emoji", null, SettingLevel.ACCOUNT, val);
}
}
@@ -95,6 +99,12 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
return content && content['recent_rooms'] ? content['recent_rooms'] : [];
}
// Special case recent emoji
if (settingName === "recent_emoji") {
const content = this._getSettings(RECENT_EMOJI_EVENT_TYPE);
return content ? content["recent_emoji"] : null;
}
// Special case integration manager provisioning
if (settingName === "integrationProvisioning") {
const content = this._getSettings(INTEG_PROVISIONING_EVENT_TYPE);
@@ -135,6 +145,13 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
return MatrixClientPeg.get().setAccountData(BREADCRUMBS_EVENT_TYPE, content);
}
// Special case recent emoji
if (settingName === "recent_emoji") {
const content = this._getSettings(RECENT_EMOJI_EVENT_TYPE) || {};
content["recent_emoji"] = newValue;
return MatrixClientPeg.get().setAccountData(RECENT_EMOJI_EVENT_TYPE, content);
}
// Special case integration manager provisioning
if (settingName === "integrationProvisioning") {
const content = this._getSettings(INTEG_PROVISIONING_EVENT_TYPE) || {};

View File

@@ -43,11 +43,14 @@ export default class RoomSettingsHandler extends MatrixClientBackedSettingsHandl
const roomId = event.getRoomId();
const room = this.client.getRoom(roomId);
// Note: the tests often fire setting updates that don't have rooms in the store, so
// we fail softly here. We shouldn't assume that the state being fired is current
// state, but we also don't need to explode just because we didn't find a room.
if (!room) console.warn(`Unknown room caused setting update: ${roomId}`);
if (room && state !== room.currentState) return; // ignore state updates which are not current
// Note: in tests and during the encryption setup on initial load we might not have
// rooms in the store, so we just quietly ignore the problem. If we log it then we'll
// just end up spamming the logs a few thousand times. It is perfectly fine for us
// to ignore the problem as the app will not have loaded enough to care yet.
if (!room) return;
// ignore state updates which are not current
if (room && state !== room.currentState) return;
if (event.getType() === "org.matrix.room.preview_urls") {
let val = event.getContent()['disable'];