Remove feature_custom_status
Rationale: It's legacy and wrong in so many ways.
This commit is contained in:
parent
4d7b7c4cc8
commit
aa664b88a4
8 changed files with 1 additions and 194 deletions
|
@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { createRef, useContext, useRef, useState } from "react";
|
import React, { createRef } from "react";
|
||||||
import { Room } from "matrix-js-sdk/src/models/room";
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import classNames from "classnames";
|
|
||||||
|
|
||||||
import { MatrixClientPeg } from "../../MatrixClientPeg";
|
import { MatrixClientPeg } from "../../MatrixClientPeg";
|
||||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||||
|
@ -32,9 +31,7 @@ import LogoutDialog from "../views/dialogs/LogoutDialog";
|
||||||
import SettingsStore from "../../settings/SettingsStore";
|
import SettingsStore from "../../settings/SettingsStore";
|
||||||
import { findHighContrastTheme, getCustomTheme, isHighContrastTheme } from "../../theme";
|
import { findHighContrastTheme, getCustomTheme, isHighContrastTheme } from "../../theme";
|
||||||
import {
|
import {
|
||||||
RovingAccessibleButton,
|
|
||||||
RovingAccessibleTooltipButton,
|
RovingAccessibleTooltipButton,
|
||||||
useRovingTabIndex,
|
|
||||||
} from "../../accessibility/RovingTabIndex";
|
} from "../../accessibility/RovingTabIndex";
|
||||||
import AccessibleButton, { ButtonEvent } from "../views/elements/AccessibleButton";
|
import AccessibleButton, { ButtonEvent } from "../views/elements/AccessibleButton";
|
||||||
import SdkConfig from "../../SdkConfig";
|
import SdkConfig from "../../SdkConfig";
|
||||||
|
@ -51,64 +48,10 @@ import { UIFeature } from "../../settings/UIFeature";
|
||||||
import HostSignupAction from "./HostSignupAction";
|
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 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";
|
||||||
|
|
||||||
const CustomStatusSection = () => {
|
|
||||||
const cli = useContext(MatrixClientContext);
|
|
||||||
const setStatus = cli.getUser(cli.getUserId()).unstable_statusMessage || "";
|
|
||||||
const [value, setValue] = useState(setStatus);
|
|
||||||
|
|
||||||
const ref = useRef<HTMLInputElement>(null);
|
|
||||||
const [onFocus, isActive] = useRovingTabIndex(ref);
|
|
||||||
|
|
||||||
const classes = classNames({
|
|
||||||
'mx_UserMenu_CustomStatusSection_field': true,
|
|
||||||
'mx_UserMenu_CustomStatusSection_field_hasQuery': value,
|
|
||||||
});
|
|
||||||
|
|
||||||
let details: JSX.Element;
|
|
||||||
if (value !== setStatus) {
|
|
||||||
details = <>
|
|
||||||
<p>{ _t("Your status will be shown to people you have a DM with.") }</p>
|
|
||||||
|
|
||||||
<RovingAccessibleButton
|
|
||||||
onClick={() => cli._unstable_setStatusMessage(value)}
|
|
||||||
kind="primary_outline"
|
|
||||||
>
|
|
||||||
{ value ? _t("Set status") : _t("Clear status") }
|
|
||||||
</RovingAccessibleButton>
|
|
||||||
</>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <form className="mx_UserMenu_CustomStatusSection">
|
|
||||||
<div className={classes}>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
value={value}
|
|
||||||
className="mx_UserMenu_CustomStatusSection_input"
|
|
||||||
onChange={e => setValue(e.target.value)}
|
|
||||||
placeholder={_t("Set a new status")}
|
|
||||||
autoComplete="off"
|
|
||||||
onFocus={onFocus}
|
|
||||||
ref={ref}
|
|
||||||
tabIndex={isActive ? 0 : -1}
|
|
||||||
/>
|
|
||||||
<AccessibleButton
|
|
||||||
// The clear button is only for mouse users
|
|
||||||
tabIndex={-1}
|
|
||||||
title={_t("Clear")}
|
|
||||||
className="mx_UserMenu_CustomStatusSection_clear"
|
|
||||||
onClick={() => setValue("")}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{ details }
|
|
||||||
</form>;
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
isPanelCollapsed: boolean;
|
isPanelCollapsed: boolean;
|
||||||
}
|
}
|
||||||
|
@ -369,11 +312,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let customStatusSection: JSX.Element;
|
|
||||||
if (SettingsStore.getValue("feature_custom_status")) {
|
|
||||||
customStatusSection = <CustomStatusSection />;
|
|
||||||
}
|
|
||||||
|
|
||||||
let feedbackButton;
|
let feedbackButton;
|
||||||
if (SettingsStore.getValue(UIFeature.Feedback)) {
|
if (SettingsStore.getValue(UIFeature.Feedback)) {
|
||||||
feedbackButton = <IconizedContextMenuOption
|
feedbackButton = <IconizedContextMenuOption
|
||||||
|
@ -457,7 +395,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
||||||
/>
|
/>
|
||||||
</RovingAccessibleTooltipButton>
|
</RovingAccessibleTooltipButton>
|
||||||
</div>
|
</div>
|
||||||
{ customStatusSection }
|
|
||||||
{ topSection }
|
{ topSection }
|
||||||
{ primaryOptionList }
|
{ primaryOptionList }
|
||||||
</IconizedContextMenu>;
|
</IconizedContextMenu>;
|
||||||
|
|
|
@ -75,7 +75,6 @@ import { UIComponent } from "../../../settings/UIFeature";
|
||||||
import { TimelineRenderingType } from "../../../contexts/RoomContext";
|
import { TimelineRenderingType } from "../../../contexts/RoomContext";
|
||||||
import RightPanelStore from '../../../stores/right-panel/RightPanelStore';
|
import RightPanelStore from '../../../stores/right-panel/RightPanelStore';
|
||||||
import { IRightPanelCardState } from '../../../stores/right-panel/RightPanelStoreIPanelState';
|
import { IRightPanelCardState } from '../../../stores/right-panel/RightPanelStoreIPanelState';
|
||||||
import { useUserStatusMessage } from "../../../hooks/useUserStatusMessage";
|
|
||||||
import UserIdentifierCustomisations from '../../../customisations/UserIdentifier';
|
import UserIdentifierCustomisations from '../../../customisations/UserIdentifier';
|
||||||
import PosthogTrackers from "../../../PosthogTrackers";
|
import PosthogTrackers from "../../../PosthogTrackers";
|
||||||
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
|
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
|
||||||
|
@ -1411,7 +1410,6 @@ const UserInfoHeader: React.FC<{
|
||||||
roomId?: string;
|
roomId?: string;
|
||||||
}> = ({ member, e2eStatus, roomId }) => {
|
}> = ({ member, e2eStatus, roomId }) => {
|
||||||
const cli = useContext(MatrixClientContext);
|
const cli = useContext(MatrixClientContext);
|
||||||
const statusMessage = useUserStatusMessage(member);
|
|
||||||
|
|
||||||
const onMemberAvatarClick = useCallback(() => {
|
const onMemberAvatarClick = useCallback(() => {
|
||||||
const avatarUrl = (member as RoomMember).getMxcAvatarUrl
|
const avatarUrl = (member as RoomMember).getMxcAvatarUrl
|
||||||
|
@ -1472,11 +1470,6 @@ const UserInfoHeader: React.FC<{
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let statusLabel = null;
|
|
||||||
if (statusMessage) {
|
|
||||||
statusLabel = <span className="mx_UserInfo_statusMessage">{ statusMessage }</span>;
|
|
||||||
}
|
|
||||||
|
|
||||||
let e2eIcon;
|
let e2eIcon;
|
||||||
if (e2eStatus) {
|
if (e2eStatus) {
|
||||||
e2eIcon = <E2EIcon size={18} status={e2eStatus} isUser={true} />;
|
e2eIcon = <E2EIcon size={18} status={e2eStatus} isUser={true} />;
|
||||||
|
@ -1499,7 +1492,6 @@ const UserInfoHeader: React.FC<{
|
||||||
<div>{ UserIdentifierCustomisations.getDisplayUserIdentifier(member.userId, { roomId, withDisplayName: true }) }</div>
|
<div>{ UserIdentifierCustomisations.getDisplayUserIdentifier(member.userId, { roomId, withDisplayName: true }) }</div>
|
||||||
<div className="mx_UserInfo_profileStatus">
|
<div className="mx_UserInfo_profileStatus">
|
||||||
{ presenceLabel }
|
{ presenceLabel }
|
||||||
{ statusLabel }
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,12 +20,10 @@ import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||||
import { DeviceInfo } from "matrix-js-sdk/src/crypto/deviceinfo";
|
import { DeviceInfo } from "matrix-js-sdk/src/crypto/deviceinfo";
|
||||||
import { UserEvent } from "matrix-js-sdk/src/models/user";
|
|
||||||
import { CryptoEvent } from "matrix-js-sdk/src/crypto";
|
import { CryptoEvent } from "matrix-js-sdk/src/crypto";
|
||||||
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
|
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
|
||||||
import { UserTrustLevel } from 'matrix-js-sdk/src/crypto/CrossSigning';
|
import { UserTrustLevel } from 'matrix-js-sdk/src/crypto/CrossSigning';
|
||||||
|
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
|
||||||
import dis from "../../../dispatcher/dispatcher";
|
import dis from "../../../dispatcher/dispatcher";
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||||
|
@ -41,7 +39,6 @@ interface IProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
statusMessage: string;
|
|
||||||
isRoomEncrypted: boolean;
|
isRoomEncrypted: boolean;
|
||||||
e2eStatus: string;
|
e2eStatus: string;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +55,6 @@ export default class MemberTile extends React.Component<IProps, IState> {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
statusMessage: this.getStatusMessage(),
|
|
||||||
isRoomEncrypted: false,
|
isRoomEncrypted: false,
|
||||||
e2eStatus: null,
|
e2eStatus: null,
|
||||||
};
|
};
|
||||||
|
@ -67,13 +63,6 @@ export default class MemberTile extends React.Component<IProps, IState> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
|
|
||||||
if (SettingsStore.getValue("feature_custom_status")) {
|
|
||||||
const { user } = this.props.member;
|
|
||||||
if (user) {
|
|
||||||
user.on(UserEvent._UnstableStatusMessage, this.onStatusMessageCommitted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const { roomId } = this.props.member;
|
const { roomId } = this.props.member;
|
||||||
if (roomId) {
|
if (roomId) {
|
||||||
const isRoomEncrypted = cli.isRoomEncrypted(roomId);
|
const isRoomEncrypted = cli.isRoomEncrypted(roomId);
|
||||||
|
@ -94,11 +83,6 @@ export default class MemberTile extends React.Component<IProps, IState> {
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
|
|
||||||
const { user } = this.props.member;
|
|
||||||
if (user) {
|
|
||||||
user.removeListener(UserEvent._UnstableStatusMessage, this.onStatusMessageCommitted);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cli) {
|
if (cli) {
|
||||||
cli.removeListener(RoomStateEvent.Events, this.onRoomStateEvents);
|
cli.removeListener(RoomStateEvent.Events, this.onRoomStateEvents);
|
||||||
cli.removeListener(CryptoEvent.UserTrustStatusChanged, this.onUserTrustStatusChanged);
|
cli.removeListener(CryptoEvent.UserTrustStatusChanged, this.onUserTrustStatusChanged);
|
||||||
|
@ -158,21 +142,6 @@ export default class MemberTile extends React.Component<IProps, IState> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getStatusMessage(): string {
|
|
||||||
const { user } = this.props.member;
|
|
||||||
if (!user) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return user.unstable_statusMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
private onStatusMessageCommitted = (): void => {
|
|
||||||
// The `User` object has observed a status message change.
|
|
||||||
this.setState({
|
|
||||||
statusMessage: this.getStatusMessage(),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: IProps, nextState: IState): boolean {
|
shouldComponentUpdate(nextProps: IProps, nextState: IState): boolean {
|
||||||
if (
|
if (
|
||||||
this.memberLastModifiedTime === undefined ||
|
this.memberLastModifiedTime === undefined ||
|
||||||
|
@ -222,11 +191,6 @@ export default class MemberTile extends React.Component<IProps, IState> {
|
||||||
const name = this.getDisplayName();
|
const name = this.getDisplayName();
|
||||||
const presenceState = member.user ? member.user.presence : null;
|
const presenceState = member.user ? member.user.presence : null;
|
||||||
|
|
||||||
let statusMessage = null;
|
|
||||||
if (member.user && SettingsStore.getValue("feature_custom_status")) {
|
|
||||||
statusMessage = this.state.statusMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
const av = (
|
const av = (
|
||||||
<MemberAvatar member={member} width={36} height={36} aria-hidden="true" />
|
<MemberAvatar member={member} width={36} height={36} aria-hidden="true" />
|
||||||
);
|
);
|
||||||
|
@ -277,7 +241,6 @@ export default class MemberTile extends React.Component<IProps, IState> {
|
||||||
nameJSX={nameJSX}
|
nameJSX={nameJSX}
|
||||||
powerStatus={powerStatus}
|
powerStatus={powerStatus}
|
||||||
showPresence={this.props.showPresence}
|
showPresence={this.props.showPresence}
|
||||||
subtextLabel={statusMessage}
|
|
||||||
e2eStatus={e2eStatus}
|
e2eStatus={e2eStatus}
|
||||||
onClick={this.onClick}
|
onClick={this.onClick}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2021 Šimon Brandner <simon.bra.ag@gmail.com>
|
|
||||||
|
|
||||||
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 { MatrixClient } from "matrix-js-sdk/src/client";
|
|
||||||
import { User, UserEvent } from "matrix-js-sdk/src/models/user";
|
|
||||||
import { useContext } from "react";
|
|
||||||
|
|
||||||
import MatrixClientContext from "../contexts/MatrixClientContext";
|
|
||||||
import { useTypedEventEmitterState } from "./useEventEmitter";
|
|
||||||
import { Member } from "../components/views/right_panel/UserInfo";
|
|
||||||
import { useFeatureEnabled } from "./useSettings";
|
|
||||||
|
|
||||||
const getUser = (cli: MatrixClient, user: Member): User => cli.getUser(user?.userId);
|
|
||||||
const getStatusMessage = (cli: MatrixClient, user: Member): string => {
|
|
||||||
return getUser(cli, user)?.unstable_statusMessage;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Hook to simplify handling Matrix User status
|
|
||||||
export const useUserStatusMessage = (member?: Member): string => {
|
|
||||||
const cli = useContext(MatrixClientContext);
|
|
||||||
const enabled = useFeatureEnabled("feature_custom_status");
|
|
||||||
const user = enabled ? getUser(cli, member) : undefined;
|
|
||||||
return useTypedEventEmitterState(user, UserEvent._UnstableStatusMessage, () => {
|
|
||||||
return getStatusMessage(cli, user);
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -881,7 +881,6 @@
|
||||||
"To leave, return to this page and use the “%(leaveTheBeta)s” button.": "To leave, return to this page and use the “%(leaveTheBeta)s” button.",
|
"To leave, return to this page and use the “%(leaveTheBeta)s” button.": "To leave, return to this page and use the “%(leaveTheBeta)s” button.",
|
||||||
"Leave the beta": "Leave the beta",
|
"Leave the beta": "Leave the beta",
|
||||||
"Thank you for trying the beta, please go into as much detail as you can so we can improve it.": "Thank you for trying the beta, please go into as much detail as you can so we can improve it.",
|
"Thank you for trying the beta, please go into as much detail as you can so we can improve it.": "Thank you for trying the beta, please go into as much detail as you can so we can improve it.",
|
||||||
"Custom user status messages": "Custom user status messages",
|
|
||||||
"Video rooms (under active development)": "Video rooms (under active development)",
|
"Video rooms (under active development)": "Video rooms (under active development)",
|
||||||
"Render simple counters in room header": "Render simple counters in room header",
|
"Render simple counters in room header": "Render simple counters in room header",
|
||||||
"Multiple integration managers (requires manual setup)": "Multiple integration managers (requires manual setup)",
|
"Multiple integration managers (requires manual setup)": "Multiple integration managers (requires manual setup)",
|
||||||
|
@ -3170,10 +3169,6 @@
|
||||||
"Uploading %(filename)s and %(count)s others|other": "Uploading %(filename)s and %(count)s others",
|
"Uploading %(filename)s and %(count)s others|other": "Uploading %(filename)s and %(count)s others",
|
||||||
"Uploading %(filename)s and %(count)s others|zero": "Uploading %(filename)s",
|
"Uploading %(filename)s and %(count)s others|zero": "Uploading %(filename)s",
|
||||||
"Uploading %(filename)s and %(count)s others|one": "Uploading %(filename)s and %(count)s other",
|
"Uploading %(filename)s and %(count)s others|one": "Uploading %(filename)s and %(count)s other",
|
||||||
"Your status will be shown to people you have a DM with.": "Your status will be shown to people you have a DM with.",
|
|
||||||
"Set status": "Set status",
|
|
||||||
"Clear status": "Clear 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>",
|
||||||
"Switch to light mode": "Switch to light mode",
|
"Switch to light mode": "Switch to light mode",
|
||||||
|
|
|
@ -23,7 +23,6 @@ import {
|
||||||
NotificationBodyEnabledController,
|
NotificationBodyEnabledController,
|
||||||
NotificationsEnabledController,
|
NotificationsEnabledController,
|
||||||
} from "./controllers/NotificationControllers";
|
} from "./controllers/NotificationControllers";
|
||||||
import CustomStatusController from "./controllers/CustomStatusController";
|
|
||||||
import ThemeController from './controllers/ThemeController';
|
import ThemeController from './controllers/ThemeController';
|
||||||
import PushToMatrixClientController from './controllers/PushToMatrixClientController';
|
import PushToMatrixClientController from './controllers/PushToMatrixClientController';
|
||||||
import ReloadOnChangeController from "./controllers/ReloadOnChangeController";
|
import ReloadOnChangeController from "./controllers/ReloadOnChangeController";
|
||||||
|
@ -255,14 +254,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
"feature_custom_status": {
|
|
||||||
isFeature: true,
|
|
||||||
labsGroup: LabGroup.Profile,
|
|
||||||
displayName: _td("Custom user status messages"),
|
|
||||||
supportedLevels: LEVELS_FEATURE,
|
|
||||||
default: false,
|
|
||||||
controller: new CustomStatusController(),
|
|
||||||
},
|
|
||||||
"feature_video_rooms": {
|
"feature_video_rooms": {
|
||||||
isFeature: true,
|
isFeature: true,
|
||||||
labsGroup: LabGroup.Rooms,
|
labsGroup: LabGroup.Rooms,
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2019, 2020 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 SettingController from "./SettingController";
|
|
||||||
import dis from "../../dispatcher/dispatcher";
|
|
||||||
import { SettingLevel } from "../SettingLevel";
|
|
||||||
|
|
||||||
export default class CustomStatusController extends SettingController {
|
|
||||||
public onChange(level: SettingLevel, roomId: string, newValue: any) {
|
|
||||||
// Dispatch setting change so that some components that are still visible when the
|
|
||||||
// Settings page is open (such as RoomTiles) can reflect the change.
|
|
||||||
dis.dispatch({
|
|
||||||
action: "feature_custom_status_changed",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,9 +32,6 @@ export function shouldCauseReorder(event: MatrixEvent): boolean {
|
||||||
// Never ignore membership changes
|
// Never ignore membership changes
|
||||||
if (type === EventType.RoomMember && prevContent.membership !== content.membership) return true;
|
if (type === EventType.RoomMember && prevContent.membership !== content.membership) return true;
|
||||||
|
|
||||||
// Ignore status changes
|
|
||||||
// XXX: This should be an enum
|
|
||||||
if (type === "im.vector.user_status") return false;
|
|
||||||
// Ignore display name changes
|
// Ignore display name changes
|
||||||
if (type === EventType.RoomMember && prevContent.displayname !== content.displayname) return false;
|
if (type === EventType.RoomMember && prevContent.displayname !== content.displayname) return false;
|
||||||
// Ignore avatar changes
|
// Ignore avatar changes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue