Add view in room to action bar in thread list (#7519)
This commit is contained in:
parent
2743a75a21
commit
336217f668
3 changed files with 39 additions and 13 deletions
|
@ -67,13 +67,13 @@ import { TimelineRenderingType } from "../../../contexts/RoomContext";
|
|||
import { MediaEventHelper } from "../../../utils/MediaEventHelper";
|
||||
import Toolbar from '../../../accessibility/Toolbar';
|
||||
import { RovingAccessibleTooltipButton } from '../../../accessibility/roving/RovingAccessibleTooltipButton';
|
||||
import { RovingThreadListContextMenu } from '../context_menus/ThreadListContextMenu';
|
||||
import { ThreadNotificationState } from '../../../stores/notifications/ThreadNotificationState';
|
||||
import { RoomNotificationStateStore } from '../../../stores/notifications/RoomNotificationStateStore';
|
||||
import { NotificationStateEvents } from '../../../stores/notifications/NotificationState';
|
||||
import { NotificationColor } from '../../../stores/notifications/NotificationColor';
|
||||
import AccessibleButton from '../elements/AccessibleButton';
|
||||
import AccessibleButton, { ButtonEvent } from '../elements/AccessibleButton';
|
||||
import { CardContext } from '../right_panel/BaseCard';
|
||||
import { copyPlaintext } from '../../../utils/strings';
|
||||
|
||||
const eventTileTypes = {
|
||||
[EventType.RoomMessage]: 'messages.MessageEvent',
|
||||
|
@ -706,6 +706,23 @@ export default class EventTile extends React.Component<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
private viewInRoom = (evt: ButtonEvent): void => {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
dis.dispatch({
|
||||
action: Action.ViewRoom,
|
||||
event_id: this.props.mxEvent.getId(),
|
||||
highlighted: true,
|
||||
room_id: this.props.mxEvent.getRoomId(),
|
||||
});
|
||||
};
|
||||
|
||||
private copyLinkToThread = async (evt: ButtonEvent): Promise<void> => {
|
||||
const { permalinkCreator, mxEvent } = this.props;
|
||||
const matrixToUrl = permalinkCreator.forEvent(mxEvent.getId());
|
||||
await copyPlaintext(matrixToUrl);
|
||||
};
|
||||
|
||||
private onRoomReceipt = (ev: MatrixEvent, room: Room): void => {
|
||||
// ignore events for other rooms
|
||||
const tileRoom = this.context.getRoom(this.props.mxEvent.getRoomId());
|
||||
|
@ -1469,15 +1486,16 @@ export default class EventTile extends React.Component<IProps, IState> {
|
|||
</div>
|
||||
<Toolbar className="mx_MessageActionBar" aria-label={_t("Message Actions")} aria-live="off">
|
||||
<RovingAccessibleTooltipButton
|
||||
className="mx_MessageActionBar_maskButton mx_MessageActionBar_threadButton"
|
||||
title={_t("Reply in thread")}
|
||||
onClick={() => showThread({ rootEvent: this.props.mxEvent, push: true })}
|
||||
key="thread"
|
||||
className="mx_MessageActionBar_maskButton mx_MessageActionBar_viewInRoom"
|
||||
onClick={this.viewInRoom}
|
||||
title={_t("View in room")}
|
||||
key="view_in_room"
|
||||
/>
|
||||
<RovingThreadListContextMenu
|
||||
mxEvent={this.props.mxEvent}
|
||||
permalinkCreator={this.props.permalinkCreator}
|
||||
onMenuToggle={this.onActionBarFocusChange}
|
||||
<RovingAccessibleTooltipButton
|
||||
className="mx_MessageActionBar_maskButton mx_MessageActionBar_copyLinkToThread"
|
||||
onClick={this.copyLinkToThread}
|
||||
title={_t("Copy link to thread")}
|
||||
key="copy_link_to_thread"
|
||||
/>
|
||||
</Toolbar>
|
||||
{ msgOption }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue