Remove feature_dnd

Rationale: it's a poor implementation and will conflict with proper feature development.
pull/28788/head^2
Travis Ralston 2022-05-06 12:29:17 -06:00
parent b5ac9493dd
commit 4d7b7c4cc8
4 changed files with 0 additions and 72 deletions

View File

@ -408,10 +408,6 @@ export const Notifier = {
// don't bother notifying as user was recently active in this room // don't bother notifying as user was recently active in this room
return; return;
} }
if (SettingsStore.getValue("doNotDisturb")) {
// Don't bother the user if they didn't ask to be bothered
return;
}
if (this.isEnabled()) { if (this.isEnabled()) {
this._displayPopupNotification(ev, room); this._displayPopupNotification(ev, room);

View File

@ -44,7 +44,6 @@ import { UPDATE_EVENT } from "../../stores/AsyncStore";
import BaseAvatar from '../views/avatars/BaseAvatar'; import BaseAvatar from '../views/avatars/BaseAvatar';
import { SettingLevel } from "../../settings/SettingLevel"; import { SettingLevel } from "../../settings/SettingLevel";
import IconizedContextMenu, { import IconizedContextMenu, {
IconizedContextMenuCheckbox,
IconizedContextMenuOption, IconizedContextMenuOption,
IconizedContextMenuOptionList, IconizedContextMenuOptionList,
} from "../views/context_menus/IconizedContextMenu"; } from "../views/context_menus/IconizedContextMenu";
@ -53,7 +52,6 @@ import HostSignupAction from "./HostSignupAction";
import SpaceStore from "../../stores/spaces/SpaceStore"; import SpaceStore from "../../stores/spaces/SpaceStore";
import { UPDATE_SELECTED_SPACE } from "../../stores/spaces"; import { UPDATE_SELECTED_SPACE } from "../../stores/spaces";
import MatrixClientContext from "../../contexts/MatrixClientContext"; import MatrixClientContext from "../../contexts/MatrixClientContext";
import { SettingUpdatedPayload } from "../../dispatcher/payloads/SettingUpdatedPayload";
import UserIdentifierCustomisations from "../../customisations/UserIdentifier"; import UserIdentifierCustomisations from "../../customisations/UserIdentifier";
import PosthogTrackers from "../../PosthogTrackers"; import PosthogTrackers from "../../PosthogTrackers";
import { ViewHomePagePayload } from "../../dispatcher/payloads/ViewHomePagePayload"; import { ViewHomePagePayload } from "../../dispatcher/payloads/ViewHomePagePayload";
@ -122,7 +120,6 @@ interface IState {
isDarkTheme: boolean; isDarkTheme: boolean;
isHighContrast: boolean; isHighContrast: boolean;
selectedSpace?: Room; selectedSpace?: Room;
dndEnabled: boolean;
} }
const toRightOf = (rect: PartialDOMRect) => { const toRightOf = (rect: PartialDOMRect) => {
@ -154,19 +151,11 @@ export default class UserMenu extends React.Component<IProps, IState> {
contextMenuPosition: null, contextMenuPosition: null,
isDarkTheme: this.isUserOnDarkTheme(), isDarkTheme: this.isUserOnDarkTheme(),
isHighContrast: this.isUserOnHighContrastTheme(), isHighContrast: this.isUserOnHighContrastTheme(),
dndEnabled: this.doNotDisturb,
selectedSpace: SpaceStore.instance.activeSpaceRoom, selectedSpace: SpaceStore.instance.activeSpaceRoom,
}; };
OwnProfileStore.instance.on(UPDATE_EVENT, this.onProfileUpdate); OwnProfileStore.instance.on(UPDATE_EVENT, this.onProfileUpdate);
SpaceStore.instance.on(UPDATE_SELECTED_SPACE, this.onSelectedSpaceUpdate); SpaceStore.instance.on(UPDATE_SELECTED_SPACE, this.onSelectedSpaceUpdate);
SettingsStore.monitorSetting("feature_dnd", null);
SettingsStore.monitorSetting("doNotDisturb", null);
}
private get doNotDisturb(): boolean {
return SettingsStore.getValue("doNotDisturb");
} }
private get hasHomePage(): boolean { private get hasHomePage(): boolean {
@ -239,20 +228,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
if (this.buttonRef.current) this.buttonRef.current.click(); if (this.buttonRef.current) this.buttonRef.current.click();
} }
break; break;
case Action.SettingUpdated: {
const settingUpdatedPayload = payload as SettingUpdatedPayload;
switch (settingUpdatedPayload.settingName) {
case "feature_dnd":
case "doNotDisturb": {
const dndEnabled = this.doNotDisturb;
if (this.state.dndEnabled !== dndEnabled) {
this.setState({ dndEnabled });
}
break;
}
}
}
} }
}; };
@ -348,12 +323,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
this.setState({ contextMenuPosition: null }); // also close the menu this.setState({ contextMenuPosition: null }); // also close the menu
}; };
private onDndToggle = (ev: ButtonEvent) => {
ev.stopPropagation();
const current = SettingsStore.getValue("doNotDisturb");
SettingsStore.setValue("doNotDisturb", null, SettingLevel.DEVICE, !current);
};
private renderContextMenu = (): React.ReactNode => { private renderContextMenu = (): React.ReactNode => {
if (!this.state.contextMenuPosition) return null; if (!this.state.contextMenuPosition) return null;
@ -405,19 +374,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
customStatusSection = <CustomStatusSection />; customStatusSection = <CustomStatusSection />;
} }
let dndButton: JSX.Element;
if (SettingsStore.getValue("feature_dnd")) {
dndButton = (
<IconizedContextMenuCheckbox
iconClassName={this.state.dndEnabled ? "mx_UserMenu_iconDnd" : "mx_UserMenu_iconDndOff"}
label={_t("Do not disturb")}
onClick={this.onDndToggle}
active={this.state.dndEnabled}
words
/>
);
}
let feedbackButton; let feedbackButton;
if (SettingsStore.getValue(UIFeature.Feedback)) { if (SettingsStore.getValue(UIFeature.Feedback)) {
feedbackButton = <IconizedContextMenuOption feedbackButton = <IconizedContextMenuOption
@ -430,7 +386,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
let primaryOptionList = ( let primaryOptionList = (
<IconizedContextMenuOptionList> <IconizedContextMenuOptionList>
{ homeButton } { homeButton }
{ dndButton }
<IconizedContextMenuOption <IconizedContextMenuOption
iconClassName="mx_UserMenu_iconBell" iconClassName="mx_UserMenu_iconBell"
label={_t("Notifications")} label={_t("Notifications")}
@ -515,11 +470,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
const displayName = OwnProfileStore.instance.displayName || userId; const displayName = OwnProfileStore.instance.displayName || userId;
const avatarUrl = OwnProfileStore.instance.getHttpAvatarUrl(avatarSize); const avatarUrl = OwnProfileStore.instance.getHttpAvatarUrl(avatarSize);
let badge: JSX.Element;
if (this.state.dndEnabled) {
badge = <div className="mx_UserMenu_dndBadge" />;
}
let name: JSX.Element; let name: JSX.Element;
if (!this.props.isPanelCollapsed) { if (!this.props.isPanelCollapsed) {
name = <div className="mx_UserMenu_name"> name = <div className="mx_UserMenu_name">
@ -534,9 +484,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
label={_t("User menu")} label={_t("User menu")}
isExpanded={!!this.state.contextMenuPosition} isExpanded={!!this.state.contextMenuPosition}
onContextMenu={this.onContextMenu} onContextMenu={this.onContextMenu}
className={classNames({
mx_UserMenu_cutout: badge,
})}
> >
<div className="mx_UserMenu_userAvatar"> <div className="mx_UserMenu_userAvatar">
<BaseAvatar <BaseAvatar
@ -548,7 +495,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
resizeMethod="crop" resizeMethod="crop"
className="mx_UserMenu_userAvatar_BaseAvatar" className="mx_UserMenu_userAvatar_BaseAvatar"
/> />
{ badge }
</div> </div>
{ name } { name }

View File

@ -869,7 +869,6 @@
"Developer": "Developer", "Developer": "Developer",
"Let moderators hide messages pending moderation.": "Let moderators hide messages pending moderation.", "Let moderators hide messages pending moderation.": "Let moderators hide messages pending moderation.",
"Report to moderators prototype. In rooms that support moderation, the `report` button will let you report abuse to room moderators": "Report to moderators prototype. In rooms that support moderation, the `report` button will let you report abuse to room moderators", "Report to moderators prototype. In rooms that support moderation, the `report` button will let you report abuse to room moderators": "Report to moderators prototype. In rooms that support moderation, the `report` button will let you report abuse to room moderators",
"Show options to enable 'Do not disturb' mode": "Show options to enable 'Do not disturb' mode",
"Render LaTeX maths in messages": "Render LaTeX maths in messages", "Render LaTeX maths in messages": "Render LaTeX maths in messages",
"Message Pinning": "Message Pinning", "Message Pinning": "Message Pinning",
"Threaded messaging": "Threaded messaging", "Threaded messaging": "Threaded messaging",
@ -3177,7 +3176,6 @@
"Set a new status": "Set a new status", "Set a new status": "Set a new status",
"Got an account? <a>Sign in</a>": "Got an account? <a>Sign in</a>", "Got an account? <a>Sign in</a>": "Got an account? <a>Sign in</a>",
"New here? <a>Create an account</a>": "New here? <a>Create an account</a>", "New here? <a>Create an account</a>": "New here? <a>Create an account</a>",
"Do not disturb": "Do not disturb",
"Switch to light mode": "Switch to light mode", "Switch to light mode": "Switch to light mode",
"Switch to dark mode": "Switch to dark mode", "Switch to dark mode": "Switch to dark mode",
"Switch theme": "Switch theme", "Switch theme": "Switch theme",

View File

@ -201,13 +201,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_FEATURE, supportedLevels: LEVELS_FEATURE,
default: false, default: false,
}, },
"feature_dnd": {
isFeature: true,
labsGroup: LabGroup.Profile,
displayName: _td("Show options to enable 'Do not disturb' mode"),
supportedLevels: LEVELS_FEATURE,
default: false,
},
"feature_latex_maths": { "feature_latex_maths": {
isFeature: true, isFeature: true,
labsGroup: LabGroup.Messaging, labsGroup: LabGroup.Messaging,
@ -344,11 +337,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
displayName: _td("Show current avatar and name for users in message history"), displayName: _td("Show current avatar and name for users in message history"),
default: false, default: false,
}, },
"doNotDisturb": {
supportedLevels: [SettingLevel.DEVICE],
default: false,
controller: new IncompatibleController("feature_dnd", false, false),
},
"mjolnirRooms": { "mjolnirRooms": {
supportedLevels: [SettingLevel.ACCOUNT], supportedLevels: [SettingLevel.ACCOUNT],
default: [], default: [],