Split out avatar and display name hiding

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-11-13 12:58:10 -07:00
parent ffecb82bca
commit 63bebe9dfd
5 changed files with 23 additions and 7 deletions

View file

@ -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" },

View file

@ -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",

View file

@ -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": {

View file

@ -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) {

View file

@ -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;