Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 7580c38

Browse files
committed
Remove old forwarding code
This has been replaced by ForwardDialog. Signed-off-by: Robin Townsend <[email protected]>
1 parent a39822c commit 7580c38

File tree

6 files changed

+2
-132
lines changed

6 files changed

+2
-132
lines changed

src/components/structures/RoomView.tsx

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import ScrollPanel from "./ScrollPanel";
6060
import TimelinePanel from "./TimelinePanel";
6161
import ErrorBoundary from "../views/elements/ErrorBoundary";
6262
import RoomPreviewBar from "../views/rooms/RoomPreviewBar";
63-
import ForwardMessage from "../views/rooms/ForwardMessage";
6463
import SearchBar from "../views/rooms/SearchBar";
6564
import RoomUpgradeWarningBar from "../views/rooms/RoomUpgradeWarningBar";
6665
import PinnedEventsPanel from "../views/rooms/PinnedEventsPanel";
@@ -136,7 +135,6 @@ export interface IState {
136135
// Whether to highlight the event scrolled to
137136
isInitialEventHighlighted?: boolean;
138137
replyToEvent?: MatrixEvent;
139-
forwardingEvent?: MatrixEvent;
140138
numUnreadMessages: number;
141139
draggingFile: boolean;
142140
searching: boolean;
@@ -324,7 +322,6 @@ export default class RoomView extends React.Component<IProps, IState> {
324322
initialEventId: RoomViewStore.getInitialEventId(),
325323
isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(),
326324
replyToEvent: RoomViewStore.getQuotingEvent(),
327-
forwardingEvent: RoomViewStore.getForwardingEvent(),
328325
// we should only peek once we have a ready client
329326
shouldPeek: this.state.matrixClientIsReady && RoomViewStore.shouldPeek(),
330327
showingPinned: SettingsStore.getValue("PinnedEvents.isOpen", roomId),
@@ -1394,18 +1391,6 @@ export default class RoomView extends React.Component<IProps, IState> {
13941391
dis.dispatch({ action: "open_room_settings" });
13951392
};
13961393

1397-
private onCancelClick = () => {
1398-
console.log("updateTint from onCancelClick");
1399-
this.updateTint();
1400-
if (this.state.forwardingEvent) {
1401-
dis.dispatch({
1402-
action: 'forward_event',
1403-
event: null,
1404-
});
1405-
}
1406-
dis.fire(Action.FocusComposer);
1407-
};
1408-
14091394
private onAppsClick = () => {
14101395
dis.dispatch({
14111396
action: "appsDrawer",
@@ -1856,11 +1841,7 @@ export default class RoomView extends React.Component<IProps, IState> {
18561841

18571842
let aux = null;
18581843
let previewBar;
1859-
let hideCancel = false;
1860-
if (this.state.forwardingEvent) {
1861-
aux = <ForwardMessage onCancelClick={this.onCancelClick} />;
1862-
} else if (this.state.searching) {
1863-
hideCancel = true; // has own cancel
1844+
if (this.state.searching) {
18641845
aux = <SearchBar
18651846
searchInProgress={this.state.searchInProgress}
18661847
onCancelClick={this.onCancelSearchClick}
@@ -1869,9 +1850,7 @@ export default class RoomView extends React.Component<IProps, IState> {
18691850
/>;
18701851
} else if (showRoomUpgradeBar) {
18711852
aux = <RoomUpgradeWarningBar room={this.state.room} recommendation={roomVersionRecommendation} />;
1872-
hideCancel = true;
18731853
} else if (this.state.showingPinned) {
1874-
hideCancel = true; // has own cancel
18751854
aux = <PinnedEventsPanel room={this.state.room} onCancelClick={this.onPinnedClick} />;
18761855
} else if (myMembership !== "join") {
18771856
// We do have a room object for this room, but we're not currently in it.
@@ -1881,7 +1860,6 @@ export default class RoomView extends React.Component<IProps, IState> {
18811860
inviterName = this.props.oobData.inviterName;
18821861
}
18831862
const invitedEmail = this.props.threepidInvite?.toEmail;
1884-
hideCancel = true;
18851863
previewBar = (
18861864
<RoomPreviewBar
18871865
onJoinClick={this.onJoinButtonClicked}
@@ -1999,11 +1977,8 @@ export default class RoomView extends React.Component<IProps, IState> {
19991977
hideMessagePanel = true;
20001978
}
20011979

2002-
const shouldHighlight = this.state.isInitialEventHighlighted;
20031980
let highlightedEventId = null;
2004-
if (this.state.forwardingEvent) {
2005-
highlightedEventId = this.state.forwardingEvent.getId();
2006-
} else if (shouldHighlight) {
1981+
if (this.state.isInitialEventHighlighted) {
20071982
highlightedEventId = this.state.initialEventId;
20081983
}
20091984

@@ -2091,7 +2066,6 @@ export default class RoomView extends React.Component<IProps, IState> {
20912066
onSearchClick={this.onSearchClick}
20922067
onSettingsClick={this.onSettingsClick}
20932068
onPinnedClick={this.onPinnedClick}
2094-
onCancelClick={(aux && !hideCancel) ? this.onCancelClick : null}
20952069
onForgetClick={(myMembership === "leave") ? this.onForgetClick : null}
20962070
onLeaveClick={(myMembership === "join") ? this.onLeaveClick : null}
20972071
e2eStatus={this.state.e2eStatus}

src/components/views/rooms/ForwardMessage.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/components/views/rooms/RoomHeader.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { _t } from '../../../languageHandler';
2222
import {MatrixClientPeg} from '../../../MatrixClientPeg';
2323
import RateLimitedFunc from '../../../ratelimitedfunc';
2424

25-
import {CancelButton} from './SimpleRoomHeader';
2625
import SettingsStore from "../../../settings/SettingsStore";
2726
import RoomHeaderButtons from '../right_panel/RoomHeaderButtons';
2827
import E2EIcon from './E2EIcon';
@@ -44,7 +43,6 @@ export default class RoomHeader extends React.Component {
4443
onPinnedClick: PropTypes.func,
4544
onSearchClick: PropTypes.func,
4645
onLeaveClick: PropTypes.func,
47-
onCancelClick: PropTypes.func,
4846
e2eStatus: PropTypes.string,
4947
onAppsClick: PropTypes.func,
5048
appsShown: PropTypes.bool,
@@ -54,7 +52,6 @@ export default class RoomHeader extends React.Component {
5452
static defaultProps = {
5553
editing: false,
5654
inRoom: false,
57-
onCancelClick: null,
5855
};
5956

6057
componentDidMount() {
@@ -120,13 +117,8 @@ export default class RoomHeader extends React.Component {
120117

121118
render() {
122119
let searchStatus = null;
123-
let cancelButton = null;
124120
let pinnedEventsButton = null;
125121

126-
if (this.props.onCancelClick) {
127-
cancelButton = <CancelButton onClick={this.props.onCancelClick} />;
128-
}
129-
130122
// don't display the search count until the search completes and
131123
// gives us a valid (possibly zero) searchCount.
132124
if (this.props.searchInfo &&
@@ -265,7 +257,6 @@ export default class RoomHeader extends React.Component {
265257
<div className="mx_RoomHeader_e2eIcon">{ e2eIcon }</div>
266258
{ name }
267259
{ topicElement }
268-
{ cancelButton }
269260
{ rightRow }
270261
<RoomHeaderButtons />
271262
</div>

src/components/views/rooms/SimpleRoomHeader.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,9 @@ limitations under the License.
1616

1717
import React from 'react';
1818
import PropTypes from 'prop-types';
19-
import AccessibleButton from '../elements/AccessibleButton';
2019
import * as sdk from '../../../index';
21-
import { _t } from '../../../languageHandler';
2220
import {replaceableComponent} from "../../../utils/replaceableComponent";
2321

24-
// cancel button which is shared between room header and simple room header
25-
export function CancelButton(props) {
26-
const {onClick} = props;
27-
28-
return (
29-
<AccessibleButton className='mx_RoomHeader_cancelButton' onClick={onClick}>
30-
<img src={require("../../../../res/img/cancel.svg")} className='mx_filterFlipColor'
31-
width="18" height="18" alt={_t("Cancel")} />
32-
</AccessibleButton>
33-
);
34-
}
35-
3622
/*
3723
* A stripped-down room header used for things like the user settings
3824
* and room directory.
@@ -41,18 +27,13 @@ export function CancelButton(props) {
4127
export default class SimpleRoomHeader extends React.Component {
4228
static propTypes = {
4329
title: PropTypes.string,
44-
onCancelClick: PropTypes.func,
4530

4631
// `src` to a TintableSvg. Optional.
4732
icon: PropTypes.string,
4833
};
4934

5035
render() {
51-
let cancelButton;
5236
let icon;
53-
if (this.props.onCancelClick) {
54-
cancelButton = <CancelButton onClick={this.props.onCancelClick} />;
55-
}
5637
if (this.props.icon) {
5738
const TintableSvg = sdk.getComponent('elements.TintableSvg');
5839
icon = <TintableSvg
@@ -67,7 +48,6 @@ export default class SimpleRoomHeader extends React.Component {
6748
<div className="mx_RoomHeader_simpleHeader">
6849
{ icon }
6950
{ this.props.title }
70-
{ cancelButton }
7151
</div>
7252
</div>
7353
</div>

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,6 @@
14581458
"Encrypting your message...": "Encrypting your message...",
14591459
"Your message was sent": "Your message was sent",
14601460
"Failed to send": "Failed to send",
1461-
"Please select the destination room for this message": "Please select the destination room for this message",
14621461
"Scroll to most recent messages": "Scroll to most recent messages",
14631462
"Close preview": "Close preview",
14641463
"and %(count)s others...|other": "and %(count)s others...",

src/stores/RoomViewStore.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ const INITIAL_STATE = {
5353
// Any error that has occurred during loading
5454
roomLoadError: null,
5555

56-
forwardingEvent: null,
57-
5856
quotingEvent: null,
5957

6058
replyingToEvent: null,
@@ -149,11 +147,6 @@ class RoomViewStore extends Store<ActionPayload> {
149147
case 'on_logged_out':
150148
this.reset();
151149
break;
152-
case 'forward_event':
153-
this.setState({
154-
forwardingEvent: payload.event,
155-
});
156-
break;
157150
case 'reply_to_event':
158151
// If currently viewed room does not match the room in which we wish to reply then change rooms
159152
// this can happen when performing a search across all rooms
@@ -186,7 +179,6 @@ class RoomViewStore extends Store<ActionPayload> {
186179
roomAlias: payload.room_alias,
187180
initialEventId: payload.event_id,
188181
isInitialEventHighlighted: payload.highlighted,
189-
forwardingEvent: null,
190182
roomLoading: false,
191183
roomLoadError: null,
192184
// should peek by default
@@ -206,14 +198,6 @@ class RoomViewStore extends Store<ActionPayload> {
206198
newState.replyingToEvent = payload.replyingToEvent;
207199
}
208200

209-
if (this.state.forwardingEvent) {
210-
dis.dispatch({
211-
action: 'send_event',
212-
room_id: newState.roomId,
213-
event: this.state.forwardingEvent,
214-
});
215-
}
216-
217201
this.setState(newState);
218202

219203
if (payload.auto_join) {
@@ -419,11 +403,6 @@ class RoomViewStore extends Store<ActionPayload> {
419403
return this.state.joinError;
420404
}
421405

422-
// The mxEvent if one is about to be forwarded
423-
public getForwardingEvent() {
424-
return this.state.forwardingEvent;
425-
}
426-
427406
// The mxEvent if one is currently being replied to/quoted
428407
public getQuotingEvent() {
429408
return this.state.replyingToEvent;

0 commit comments

Comments
 (0)