Remove feature_favourite_messages
as it is has been abandoned for now (#11097)
* Remove `feature_favourite_messages` as it is has been abandoned for now * i18n * Fix test * Remove unused css
This commit is contained in:
parent
386a459b9f
commit
cb2b1718ff
7 changed files with 3 additions and 219 deletions
|
@ -28,7 +28,6 @@ import { Icon as EmojiIcon } from "../../../../res/img/element-icons/room/messag
|
|||
import { Icon as ResendIcon } from "../../../../res/img/element-icons/retry.svg";
|
||||
import { Icon as ThreadIcon } from "../../../../res/img/element-icons/message/thread.svg";
|
||||
import { Icon as TrashcanIcon } from "../../../../res/img/element-icons/trashcan.svg";
|
||||
import { Icon as StarIcon } from "../../../../res/img/element-icons/room/message-bar/star.svg";
|
||||
import { Icon as ReplyIcon } from "../../../../res/img/element-icons/room/message-bar/reply.svg";
|
||||
import { Icon as ExpandMessageIcon } from "../../../../res/img/element-icons/expand-message.svg";
|
||||
import { Icon as CollapseMessageIcon } from "../../../../res/img/element-icons/collapse-message.svg";
|
||||
|
@ -45,7 +44,6 @@ import Resend from "../../../Resend";
|
|||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
import { MediaEventHelper } from "../../../utils/MediaEventHelper";
|
||||
import DownloadActionButton from "./DownloadActionButton";
|
||||
import SettingsStore from "../../../settings/SettingsStore";
|
||||
import { RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks";
|
||||
import ReplyChain from "../elements/ReplyChain";
|
||||
import ReactionPicker from "../emojipicker/ReactionPicker";
|
||||
|
@ -55,7 +53,6 @@ import { Key } from "../../../Keyboard";
|
|||
import { ALTERNATE_KEY_NAME } from "../../../accessibility/KeyboardShortcuts";
|
||||
import { Action } from "../../../dispatcher/actions";
|
||||
import { ShowThreadPayload } from "../../../dispatcher/payloads/ShowThreadPayload";
|
||||
import useFavouriteMessages from "../../../hooks/useFavouriteMessages";
|
||||
import { GetRelationsForEvent } from "../rooms/EventTile";
|
||||
import { VoiceBroadcastInfoEventType } from "../../../voice-broadcast/types";
|
||||
import { ButtonEvent } from "../elements/AccessibleButton";
|
||||
|
@ -254,42 +251,6 @@ const ReplyInThreadButton: React.FC<IReplyInThreadButton> = ({ mxEvent }) => {
|
|||
);
|
||||
};
|
||||
|
||||
interface IFavouriteButtonProp {
|
||||
mxEvent: MatrixEvent;
|
||||
}
|
||||
|
||||
const FavouriteButton: React.FC<IFavouriteButtonProp> = ({ mxEvent }) => {
|
||||
const { isFavourite, toggleFavourite } = useFavouriteMessages();
|
||||
|
||||
const eventId = mxEvent.getId()!;
|
||||
const classes = classNames("mx_MessageActionBar_iconButton mx_MessageActionBar_favouriteButton", {
|
||||
mx_MessageActionBar_favouriteButton_fillstar: isFavourite(eventId),
|
||||
});
|
||||
|
||||
const onClick = useCallback(
|
||||
(e: ButtonEvent) => {
|
||||
// Don't open the regular browser or our context menu on right-click
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
toggleFavourite(eventId);
|
||||
},
|
||||
[toggleFavourite, eventId],
|
||||
);
|
||||
|
||||
return (
|
||||
<RovingAccessibleTooltipButton
|
||||
className={classes}
|
||||
title={_t("Favourite")}
|
||||
onClick={onClick}
|
||||
onContextMenu={onClick}
|
||||
data-testid={eventId}
|
||||
>
|
||||
<StarIcon />
|
||||
</RovingAccessibleTooltipButton>
|
||||
);
|
||||
};
|
||||
|
||||
interface IMessageActionBarProps {
|
||||
mxEvent: MatrixEvent;
|
||||
reactions?: Relations | null | undefined;
|
||||
|
@ -518,9 +479,6 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
|
|||
/>,
|
||||
);
|
||||
}
|
||||
if (SettingsStore.getValue("feature_favourite_messages")) {
|
||||
toolbarOpts.splice(-1, 0, <FavouriteButton key="favourite" mxEvent={this.props.mxEvent} />);
|
||||
}
|
||||
|
||||
// XXX: Assuming that the underlying tile will be a media event if it is eligible media.
|
||||
if (MediaEventHelper.isEligible(this.props.mxEvent)) {
|
||||
|
|
|
@ -78,7 +78,6 @@ interface IState {
|
|||
sublists: ITagMap;
|
||||
currentRoomId?: string;
|
||||
suggestedRooms: ISuggestedRoom[];
|
||||
feature_favourite_messages: boolean;
|
||||
}
|
||||
|
||||
export const TAG_ORDER: TagID[] = [
|
||||
|
@ -443,7 +442,6 @@ const TAG_AESTHETICS: TagAestheticsMap = {
|
|||
export default class RoomList extends React.PureComponent<IProps, IState> {
|
||||
private dispatcherRef?: string;
|
||||
private treeRef = createRef<HTMLDivElement>();
|
||||
private favouriteMessageWatcher?: string;
|
||||
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
|
@ -454,7 +452,6 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
this.state = {
|
||||
sublists: {},
|
||||
suggestedRooms: SpaceStore.instance.suggestedRooms,
|
||||
feature_favourite_messages: SettingsStore.getValue("feature_favourite_messages"),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -463,20 +460,12 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
SdkContextClass.instance.roomViewStore.on(UPDATE_EVENT, this.onRoomViewStoreUpdate);
|
||||
SpaceStore.instance.on(UPDATE_SUGGESTED_ROOMS, this.updateSuggestedRooms);
|
||||
RoomListStore.instance.on(LISTS_UPDATE_EVENT, this.updateLists);
|
||||
this.favouriteMessageWatcher = SettingsStore.watchSetting(
|
||||
"feature_favourite_messages",
|
||||
null,
|
||||
(...[, , , value]) => {
|
||||
this.setState({ feature_favourite_messages: value });
|
||||
},
|
||||
);
|
||||
this.updateLists(); // trigger the first update
|
||||
}
|
||||
|
||||
public componentWillUnmount(): void {
|
||||
SpaceStore.instance.off(UPDATE_SUGGESTED_ROOMS, this.updateSuggestedRooms);
|
||||
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this.updateLists);
|
||||
if (this.favouriteMessageWatcher) SettingsStore.unwatchSetting(this.favouriteMessageWatcher);
|
||||
if (this.dispatcherRef) defaultDispatcher.unregister(this.dispatcherRef);
|
||||
SdkContextClass.instance.roomViewStore.off(UPDATE_EVENT, this.onRoomViewStoreUpdate);
|
||||
}
|
||||
|
@ -607,29 +596,6 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
);
|
||||
});
|
||||
}
|
||||
private renderFavoriteMessagesList(): ReactComponentElement<typeof ExtraTile>[] {
|
||||
const avatar = (
|
||||
<RoomAvatar
|
||||
oobData={{
|
||||
name: "Favourites",
|
||||
}}
|
||||
width={32}
|
||||
height={32}
|
||||
resizeMethod="crop"
|
||||
/>
|
||||
);
|
||||
|
||||
return [
|
||||
<ExtraTile
|
||||
isMinimized={this.props.isMinimized}
|
||||
isSelected={false}
|
||||
displayName="Favourite Messages"
|
||||
avatar={avatar}
|
||||
onClick={() => ""}
|
||||
key="favMessagesTile_key"
|
||||
/>,
|
||||
];
|
||||
}
|
||||
|
||||
private renderSublists(): React.ReactElement[] {
|
||||
// show a skeleton UI if the user is in no rooms and they are not filtering and have no suggested rooms
|
||||
|
@ -641,8 +607,6 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
let extraTiles: ReactComponentElement<typeof ExtraTile>[] | undefined;
|
||||
if (orderedTagId === DefaultTagID.Suggested) {
|
||||
extraTiles = this.renderSuggestedRooms();
|
||||
} else if (this.state.feature_favourite_messages && orderedTagId === DefaultTagID.SavedItems) {
|
||||
extraTiles = this.renderFavoriteMessagesList();
|
||||
}
|
||||
|
||||
const aesthetics = TAG_AESTHETICS[orderedTagId];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue