diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 603543b841..692dd4e01d 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -68,7 +68,8 @@ const SIMPLE_SETTINGS = [ { id: "alwaysShowTimestamps" }, { id: "showTwelveHourTimestamps" }, { id: "hideJoinLeaves" }, - { id: "hideAvatarDisplaynameChanges" }, + { id: "hideAvatarChanges" }, + { id: "hideDisplaynameChanges" }, { id: "useCompactLayout" }, { id: "hideRedactions" }, { id: "enableSyntaxHighlightLanguageDetection" }, diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 33fb7e41a9..a9371c3126 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -163,6 +163,8 @@ "Not a valid Riot keyfile": "Not a valid Riot keyfile", "Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?", "Failed to join room": "Failed to join room", + "Hide avatar changes": "Hide avatar changes", + "Hide display name changes": "Hide display name changes", "Enable inline URL previews by default": "Enable inline URL previews by default", "Enable URL previews for this room (only affects you)": "Enable URL previews for this room (only affects you)", "Enable URL previews by default for participants in this room": "Enable URL previews by default for participants in this room", @@ -762,7 +764,6 @@ "Always show message timestamps": "Always show message timestamps", "Show timestamps in 12 hour format (e.g. 2:30pm)": "Show timestamps in 12 hour format (e.g. 2:30pm)", "Hide join/leave messages (invites/kicks/bans unaffected)": "Hide join/leave messages (invites/kicks/bans unaffected)", - "Hide avatar and display name changes": "Hide avatar and display name changes", "Use compact timeline layout": "Use compact timeline layout", "Hide removed messages": "Hide removed messages", "Enable automatic language detection for syntax highlighting": "Enable automatic language detection for syntax highlighting", diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 4a879940f7..e49b9e8cc8 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -102,9 +102,14 @@ export const SETTINGS = { displayName: _td('Hide join/leave messages (invites/kicks/bans unaffected)'), default: false, }, - "hideAvatarDisplaynameChanges": { + "hideAvatarChanges": { supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM, - displayName: _td('Hide avatar and display name changes'), + displayName: _td('Hide avatar changes'), + default: false, + }, + "hideDisplaynameChanges": { + supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM, + displayName: _td('Hide display name changes'), default: false, }, "hideReadReceipts": { diff --git a/src/settings/handlers/AccountSettingsHandler.js b/src/settings/handlers/AccountSettingsHandler.js index 393410ae29..452b332f00 100644 --- a/src/settings/handlers/AccountSettingsHandler.js +++ b/src/settings/handlers/AccountSettingsHandler.js @@ -29,7 +29,16 @@ export default class AccountSettingHandler extends SettingsHandler { return !content['disable']; } - return this._getSettings()[settingName]; + let preferredValue = this._getSettings()[settingName]; + + if (preferredValue === null || preferredValue === undefined) { + // Honour the old setting on read only + if (settingName === "hideAvatarChanges" || settingName === "hideDisplaynameChanges") { + preferredValue = this._getSettings()["hideAvatarDisplaynameChanges"] + } + } + + return preferredValue; } setValue(settingName, roomId, newValue) { diff --git a/src/shouldHideEvent.js b/src/shouldHideEvent.js index e8e443b988..1ecd1ac051 100644 --- a/src/shouldHideEvent.js +++ b/src/shouldHideEvent.js @@ -47,8 +47,8 @@ export default function shouldHideEvent(ev) { if (eventDiff.isMemberEvent) { if (isEnabled('hideJoinLeaves') && (eventDiff.isJoin || eventDiff.isPart)) return true; - const isMemberAvatarDisplaynameChange = eventDiff.isAvatarChange || eventDiff.isDisplaynameChange; - if (isEnabled('hideAvatarDisplaynameChanges') && isMemberAvatarDisplaynameChange) return true; + if (isEnabled('hideAvatarChanges') && eventDiff.isAvatarChange) return true; + if (isEnabled('hideDisplaynameChanges') && eventDiff.isDisplaynameChange) return true; } return false;