diff --git a/res/css/views/dialogs/_UserSettingsDialog.scss b/res/css/views/dialogs/_UserSettingsDialog.scss index 2a046ff501..4d831d7858 100644 --- a/res/css/views/dialogs/_UserSettingsDialog.scss +++ b/res/css/views/dialogs/_UserSettingsDialog.scss @@ -45,6 +45,10 @@ limitations under the License. mask-image: url('$(res)/img/feather-customised/flag.svg'); } +.mx_UserSettingsDialog_mjolnirIcon::before { + mask-image: url('$(res)/img/feather-customised/face.svg'); +} + .mx_UserSettingsDialog_flairIcon::before { mask-image: url('$(res)/img/feather-customised/flair.svg'); } diff --git a/src/components/views/dialogs/UserSettingsDialog.js b/src/components/views/dialogs/UserSettingsDialog.js index fb9045f05a..6e324ad3fb 100644 --- a/src/components/views/dialogs/UserSettingsDialog.js +++ b/src/components/views/dialogs/UserSettingsDialog.js @@ -1,5 +1,6 @@ /* Copyright 2019 New Vector Ltd +Copyright 2019 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -29,12 +30,34 @@ import HelpUserSettingsTab from "../settings/tabs/user/HelpUserSettingsTab"; import FlairUserSettingsTab from "../settings/tabs/user/FlairUserSettingsTab"; import sdk from "../../../index"; import SdkConfig from "../../../SdkConfig"; +import MjolnirUserSettingsTab from "../settings/tabs/user/MjolnirUserSettingsTab"; export default class UserSettingsDialog extends React.Component { static propTypes = { onFinished: PropTypes.func.isRequired, }; + constructor() { + super(); + + this.state = { + mjolnirEnabled: SettingsStore.isFeatureEnabled("feature_mjolnir"), + } + } + + componentDidMount(): void { + this._mjolnirWatcher = SettingsStore.watchSetting("feature_mjolnir", null, this._mjolnirChanged.bind(this)); + } + + componentWillUnmount(): void { + SettingsStore.unwatchSetting(this._mjolnirWatcher); + } + + _mjolnirChanged(settingName, roomId, atLevel, newValue) { + // We can cheat because we know what levels a feature is tracked at, and how it is tracked + this.setState({mjolnirEnabled: newValue}); + } + _getTabs() { const tabs = []; @@ -75,6 +98,13 @@ export default class UserSettingsDialog extends React.Component { , )); } + if (this.state.mjolnirEnabled) { + tabs.push(new Tab( + _td("Ignored users"), + "mx_UserSettingsDialog_mjolnirIcon", + , + )); + } tabs.push(new Tab( _td("Help & About"), "mx_UserSettingsDialog_helpIcon", diff --git a/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js new file mode 100644 index 0000000000..02e64c0bc1 --- /dev/null +++ b/src/components/views/settings/tabs/user/MjolnirUserSettingsTab.js @@ -0,0 +1,74 @@ +/* +Copyright 2019 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import React from 'react'; +import {_t} from "../../../../../languageHandler"; +const sdk = require("../../../../.."); + +export default class MjolnirUserSettingsTab extends React.Component { + constructor() { + super(); + } + + render() { + return ( +
+
{_t("Ignored users")}
+
+
+ {_t("⚠ These settings are meant for advanced users.")}
+
+ {_t( + "Add users and servers you want to ignore here. Use asterisks " + + "to have Riot match any characters. For example, @bot:* " + + "would ignore all users that have the name 'bot' on any server.", + {}, {code: (s) => {s}}, + )}
+
+ {_t( + "Ignoring people is done through ban lists which contain rules for " + + "who to ban. Subscribing to a ban list means the users/servers blocked by " + + "that list will be hidden from you." + )} +
+
+
+ {_t("Personal ban list")} +
+ {_t( + "Your personal ban list holds all the users/servers you personally don't " + + "want to see messages from. After ignoring your first user/server, a new room " + + "will show up in your room list named 'My Ban List' - stay in this room to keep " + + "the ban list in effect.", + )} +
+

TODO

+
+
+ {_t("Subscribed lists")} +
+ {_t("Subscribing to a ban list will cause you to join it!")} +   + {_t( + "If this isn't what you want, please use a different tool to ignore users.", + )} +
+

TODO

+
+
+ ); + } +} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 524a8a1abf..e909f49159 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -335,6 +335,7 @@ "Render simple counters in room header": "Render simple counters in room header", "Multiple integration managers": "Multiple integration managers", "Use the new, consistent UserInfo panel for Room Members and Group Members": "Use the new, consistent UserInfo panel for Room Members and Group Members", + "Try out new ways to ignore people (experimental)": "Try out new ways to ignore people (experimental)", "Use the new, faster, composer for writing messages": "Use the new, faster, composer for writing messages", "Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing", "Use compact timeline layout": "Use compact timeline layout", @@ -637,6 +638,15 @@ "Access Token:": "Access Token:", "click to reveal": "click to reveal", "Labs": "Labs", + "Ignored users": "Ignored users", + "⚠ These settings are meant for advanced users.": "⚠ These settings are meant for advanced users.", + "Add users and servers you want to ignore here. Use asterisks to have Riot match any characters. For example, @bot:* would ignore all users that have the name 'bot' on any server.": "Add users and servers you want to ignore here. Use asterisks to have Riot match any characters. For example, @bot:* would ignore all users that have the name 'bot' on any server.", + "Ignoring people is done through ban lists which contain rules for who to ban. Subscribing to a ban list means the users/servers blocked by that list will be hidden from you.": "Ignoring people is done through ban lists which contain rules for who to ban. Subscribing to a ban list means the users/servers blocked by that list will be hidden from you.", + "Personal ban list": "Personal ban list", + "Your personal ban list holds all the users/servers you personally don't want to see messages from. After ignoring your first user/server, a new room will show up in your room list named 'My Ban List' - stay in this room to keep the ban list in effect.": "Your personal ban list holds all the users/servers you personally don't want to see messages from. After ignoring your first user/server, a new room will show up in your room list named 'My Ban List' - stay in this room to keep the ban list in effect.", + "Subscribed lists": "Subscribed lists", + "Subscribing to a ban list will cause you to join it!": "Subscribing to a ban list will cause you to join it!", + "If this isn't what you want, please use a different tool to ignore users.": "If this isn't what you want, please use a different tool to ignore users.", "Notifications": "Notifications", "Start automatically after system login": "Start automatically after system login", "Always show the window menu bar": "Always show the window menu bar", @@ -654,7 +664,6 @@ "Cryptography": "Cryptography", "Device ID:": "Device ID:", "Device key:": "Device key:", - "Ignored users": "Ignored users", "Bulk options": "Bulk options", "Accept all %(invitedRooms)s invites": "Accept all %(invitedRooms)s invites", "Reject all %(invitedRooms)s invites": "Reject all %(invitedRooms)s invites", diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 7470641359..1cfff0182e 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -126,6 +126,20 @@ export const SETTINGS = { supportedLevels: LEVELS_FEATURE, default: false, }, + "feature_mjolnir": { + isFeature: true, + displayName: _td("Try out new ways to ignore people (experimental)"), + supportedLevels: LEVELS_FEATURE, + default: false, + }, + "mjolnirRooms": { + supportedLevels: ['account'], + default: [], + }, + "mjolnirPersonalRoom": { + supportedLevels: ['account'], + default: null, + }, "useCiderComposer": { displayName: _td("Use the new, faster, composer for writing messages"), supportedLevels: LEVELS_ACCOUNT_SETTINGS,