diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index b389632499..a9f072b21f 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and 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 classNames from "classnames"; import { MatrixClientPeg } from "../../MatrixClientPeg"; import defaultDispatcher from "../../dispatcher/dispatcher"; @@ -32,9 +31,7 @@ import LogoutDialog from "../views/dialogs/LogoutDialog"; import SettingsStore from "../../settings/SettingsStore"; import { findHighContrastTheme, getCustomTheme, isHighContrastTheme } from "../../theme"; import { - RovingAccessibleButton, RovingAccessibleTooltipButton, - useRovingTabIndex, } from "../../accessibility/RovingTabIndex"; import AccessibleButton, { ButtonEvent } from "../views/elements/AccessibleButton"; import SdkConfig from "../../SdkConfig"; @@ -51,64 +48,10 @@ import { UIFeature } from "../../settings/UIFeature"; import HostSignupAction from "./HostSignupAction"; import SpaceStore from "../../stores/spaces/SpaceStore"; import { UPDATE_SELECTED_SPACE } from "../../stores/spaces"; -import MatrixClientContext from "../../contexts/MatrixClientContext"; import UserIdentifierCustomisations from "../../customisations/UserIdentifier"; import PosthogTrackers from "../../PosthogTrackers"; 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(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 = <> -

{ _t("Your status will be shown to people you have a DM with.") }

- - cli._unstable_setStatusMessage(value)} - kind="primary_outline" - > - { value ? _t("Set status") : _t("Clear status") } - - ; - } - - return
-
- setValue(e.target.value)} - placeholder={_t("Set a new status")} - autoComplete="off" - onFocus={onFocus} - ref={ref} - tabIndex={isActive ? 0 : -1} - /> - setValue("")} - /> -
- - { details } -
; -}; - interface IProps { isPanelCollapsed: boolean; } @@ -369,11 +312,6 @@ export default class UserMenu extends React.Component { ); } - let customStatusSection: JSX.Element; - if (SettingsStore.getValue("feature_custom_status")) { - customStatusSection = ; - } - let feedbackButton; if (SettingsStore.getValue(UIFeature.Feedback)) { feedbackButton = { /> - { customStatusSection } { topSection } { primaryOptionList } ; diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index 9d17c5237d..7b45746c77 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -75,7 +75,6 @@ import { UIComponent } from "../../../settings/UIFeature"; import { TimelineRenderingType } from "../../../contexts/RoomContext"; import RightPanelStore from '../../../stores/right-panel/RightPanelStore'; import { IRightPanelCardState } from '../../../stores/right-panel/RightPanelStoreIPanelState'; -import { useUserStatusMessage } from "../../../hooks/useUserStatusMessage"; import UserIdentifierCustomisations from '../../../customisations/UserIdentifier'; import PosthogTrackers from "../../../PosthogTrackers"; import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload"; @@ -1411,7 +1410,6 @@ const UserInfoHeader: React.FC<{ roomId?: string; }> = ({ member, e2eStatus, roomId }) => { const cli = useContext(MatrixClientContext); - const statusMessage = useUserStatusMessage(member); const onMemberAvatarClick = useCallback(() => { const avatarUrl = (member as RoomMember).getMxcAvatarUrl @@ -1472,11 +1470,6 @@ const UserInfoHeader: React.FC<{ ); } - let statusLabel = null; - if (statusMessage) { - statusLabel = { statusMessage }; - } - let e2eIcon; if (e2eStatus) { e2eIcon = ; @@ -1499,7 +1492,6 @@ const UserInfoHeader: React.FC<{
{ UserIdentifierCustomisations.getDisplayUserIdentifier(member.userId, { roomId, withDisplayName: true }) }
{ presenceLabel } - { statusLabel }
diff --git a/src/components/views/rooms/MemberTile.tsx b/src/components/views/rooms/MemberTile.tsx index b652771a43..f292ec3b58 100644 --- a/src/components/views/rooms/MemberTile.tsx +++ b/src/components/views/rooms/MemberTile.tsx @@ -20,12 +20,10 @@ import { RoomMember } from "matrix-js-sdk/src/models/room-member"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { EventType } from "matrix-js-sdk/src/@types/event"; 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 { RoomStateEvent } from "matrix-js-sdk/src/models/room-state"; import { UserTrustLevel } from 'matrix-js-sdk/src/crypto/CrossSigning'; -import SettingsStore from "../../../settings/SettingsStore"; import dis from "../../../dispatcher/dispatcher"; import { _t } from '../../../languageHandler'; import { MatrixClientPeg } from "../../../MatrixClientPeg"; @@ -41,7 +39,6 @@ interface IProps { } interface IState { - statusMessage: string; isRoomEncrypted: boolean; e2eStatus: string; } @@ -58,7 +55,6 @@ export default class MemberTile extends React.Component { super(props); this.state = { - statusMessage: this.getStatusMessage(), isRoomEncrypted: false, e2eStatus: null, }; @@ -67,13 +63,6 @@ export default class MemberTile extends React.Component { componentDidMount() { 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; if (roomId) { const isRoomEncrypted = cli.isRoomEncrypted(roomId); @@ -94,11 +83,6 @@ export default class MemberTile extends React.Component { componentWillUnmount() { const cli = MatrixClientPeg.get(); - const { user } = this.props.member; - if (user) { - user.removeListener(UserEvent._UnstableStatusMessage, this.onStatusMessageCommitted); - } - if (cli) { cli.removeListener(RoomStateEvent.Events, this.onRoomStateEvents); cli.removeListener(CryptoEvent.UserTrustStatusChanged, this.onUserTrustStatusChanged); @@ -158,21 +142,6 @@ export default class MemberTile extends React.Component { }); } - 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 { if ( this.memberLastModifiedTime === undefined || @@ -222,11 +191,6 @@ export default class MemberTile extends React.Component { const name = this.getDisplayName(); 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 = (