Fix ForwardDialog crashing when rendering reply
Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
parent
c96888c9cb
commit
100efb1a90
2 changed files with 8 additions and 2 deletions
|
@ -158,6 +158,7 @@ export default class MessageContextMenu extends React.Component {
|
||||||
Modal.createTrackedDialog('Forward Message', '', ForwardDialog, {
|
Modal.createTrackedDialog('Forward Message', '', ForwardDialog, {
|
||||||
cli: MatrixClientPeg.get(),
|
cli: MatrixClientPeg.get(),
|
||||||
event: this.props.mxEvent,
|
event: this.props.mxEvent,
|
||||||
|
permalinkCreator: this.props.permalinkCreator,
|
||||||
}, 'mx_Dialog_forwardmessage');
|
}, 'mx_Dialog_forwardmessage');
|
||||||
this.closeMenu();
|
this.closeMenu();
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,7 @@ import RoomAvatar from "../avatars/RoomAvatar";
|
||||||
import AccessibleButton from "../elements/AccessibleButton";
|
import AccessibleButton from "../elements/AccessibleButton";
|
||||||
import AutoHideScrollbar from "../../structures/AutoHideScrollbar";
|
import AutoHideScrollbar from "../../structures/AutoHideScrollbar";
|
||||||
import DMRoomMap from "../../../utils/DMRoomMap";
|
import DMRoomMap from "../../../utils/DMRoomMap";
|
||||||
|
import {RoomPermalinkCreator} from "../../../utils/permalinks/Permalinks";
|
||||||
import {sortRooms} from "../../../stores/room-list/algorithms/tag-sorting/RecentAlgorithm";
|
import {sortRooms} from "../../../stores/room-list/algorithms/tag-sorting/RecentAlgorithm";
|
||||||
|
|
||||||
const AVATAR_SIZE = 30;
|
const AVATAR_SIZE = 30;
|
||||||
|
@ -41,6 +42,9 @@ interface IProps extends IDialogProps {
|
||||||
cli: MatrixClient;
|
cli: MatrixClient;
|
||||||
// The event to forward
|
// The event to forward
|
||||||
event: MatrixEvent;
|
event: MatrixEvent;
|
||||||
|
// We need a permalink creator for the source room to pass through to EventTile
|
||||||
|
// in case the event is a reply (even though the user can't get at the link)
|
||||||
|
permalinkCreator: RoomPermalinkCreator;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IEntryProps {
|
interface IEntryProps {
|
||||||
|
@ -97,7 +101,7 @@ const Entry: React.FC<IEntryProps> = ({ room, send }) => {
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ForwardDialog: React.FC<IProps> = ({ cli, event, onFinished }) => {
|
const ForwardDialog: React.FC<IProps> = ({ cli, event, permalinkCreator, onFinished }) => {
|
||||||
const userId = cli.getUserId();
|
const userId = cli.getUserId();
|
||||||
const [profileInfo, setProfileInfo] = useState<any>({});
|
const [profileInfo, setProfileInfo] = useState<any>({});
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -113,7 +117,7 @@ const ForwardDialog: React.FC<IProps> = ({ cli, event, onFinished }) => {
|
||||||
age: 97,
|
age: 97,
|
||||||
},
|
},
|
||||||
event_id: "$9999999999999999999999999999999999999999999",
|
event_id: "$9999999999999999999999999999999999999999999",
|
||||||
room_id: "!999999999999999999:example.org",
|
room_id: event.getRoomId(),
|
||||||
});
|
});
|
||||||
mockEvent.sender = {
|
mockEvent.sender = {
|
||||||
name: profileInfo.displayname || userId,
|
name: profileInfo.displayname || userId,
|
||||||
|
@ -165,6 +169,7 @@ const ForwardDialog: React.FC<IProps> = ({ cli, event, onFinished }) => {
|
||||||
mxEvent={mockEvent}
|
mxEvent={mockEvent}
|
||||||
layout={previewLayout}
|
layout={previewLayout}
|
||||||
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
|
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
|
||||||
|
permalinkCreator={permalinkCreator}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_ForwardList">
|
<div className="mx_ForwardList">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue