Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tore Simonsen committed Aug 12, 2024
1 parent 7b60af3 commit d8300bc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 29 deletions.
13 changes: 7 additions & 6 deletions src/components/structures/ViewSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import SyntaxHighlight from "../views/elements/SyntaxHighlight";
import { _t } from "../../languageHandler";
import MatrixClientContext from "../../contexts/MatrixClientContext";
// import { canEditContent } from "../../utils/EventUtils"; //Verji
import { MatrixClientPeg } from "../../MatrixClientPeg";
// import { MatrixClientPeg } from "../../MatrixClientPeg"; //Verji
import BaseDialog from "../views/dialogs/BaseDialog";
import { DevtoolsContext } from "../views/dialogs/devtools/BaseTool";
import { StateEventEditor } from "../views/dialogs/devtools/RoomState";
Expand Down Expand Up @@ -143,11 +143,12 @@ export default class ViewSource extends React.Component<IProps, IState> {
);
}

private canSendStateEvent(mxEvent: MatrixEvent): boolean {
const cli = MatrixClientPeg.safeGet();
const room = cli.getRoom(mxEvent.getRoomId());
return !!room?.currentState.mayClientSendStateEvent(mxEvent.getType(), cli);
}
// VERJI comment method out, (not in use as: canEdit also commented out)
// private canSendStateEvent(mxEvent: MatrixEvent): boolean {
// const cli = MatrixClientPeg.safeGet();
// const room = cli.getRoom(mxEvent.getRoomId());
// return !!room?.currentState.mayClientSendStateEvent(mxEvent.getType(), cli);
// }

public render(): React.ReactNode {
const mxEvent = this.props.mxEvent.replacingEvent() || this.props.mxEvent; // show the replacing event, not the original, if it is an edit
Expand Down
36 changes: 19 additions & 17 deletions src/components/views/context_menus/MessageContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ import ContextMenu, { toRightOf, MenuProps } from "../../structures/ContextMenu"
import ReactionPicker from "../emojipicker/ReactionPicker";
import ViewSource from "../../structures/ViewSource";
import { createRedactEventDialog } from "../dialogs/ConfirmRedactDialog";
import ShareDialog from "../dialogs/ShareDialog";
// import ShareDialog from "../dialogs/ShareDialog"; //Verji
import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext";
import EndPollDialog from "../dialogs/EndPollDialog";
import { isPollEnded } from "../messages/MPollBody";
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
import { GetRelationsForEvent, IEventTileOps } from "../rooms/EventTile";
import { OpenForwardDialogPayload } from "../../../dispatcher/payloads/OpenForwardDialogPayload";
import { OpenReportEventDialogPayload } from "../../../dispatcher/payloads/OpenReportEventDialogPayload";
// import { OpenReportEventDialogPayload } from "../../../dispatcher/payloads/OpenReportEventDialogPayload"; //VERJI
import { createMapSiteLinkFromEvent } from "../../../utils/location";
import { getForwardableEvent } from "../../../events/forward/getForwardableEvent";
import { getShareableLocationEvent } from "../../../events/location/getShareableLocationEvent";
Expand Down Expand Up @@ -246,13 +246,14 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
});
};

private onReportEventClick = (): void => {
dis.dispatch<OpenReportEventDialogPayload>({
action: Action.OpenReportEventDialog,
event: this.props.mxEvent,
});
this.closeMenu();
};
// VERJI method no longer in use, as we commented out reportEventButton
// private onReportEventClick = (): void => {
// dis.dispatch<OpenReportEventDialogPayload>({
// action: Action.OpenReportEventDialog,
// event: this.props.mxEvent,
// });
// this.closeMenu();
// };

private onViewSourceClick = (): void => {
Modal.createDialog(
Expand Down Expand Up @@ -312,14 +313,15 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
this.closeMenu();
};

private onShareClick = (e: ButtonEvent): void => {
e.preventDefault();
Modal.createDialog(ShareDialog, {
target: this.props.mxEvent,
permalinkCreator: this.props.permalinkCreator,
});
this.closeMenu();
};
// VERJI commented out as share has been removed
// private onShareClick = (e: ButtonEvent): void => {
// e.preventDefault();
// Modal.createDialog(ShareDialog, {
// target: this.props.mxEvent,
// permalinkCreator: this.props.permalinkCreator,
// });
// this.closeMenu();
// };

private onCopyLinkClick = (e: ButtonEvent): void => {
e.preventDefault(); // So that we don't open the permalink
Expand Down
12 changes: 7 additions & 5 deletions src/components/views/dialogs/InviteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ class DMEmailTile extends React.PureComponent<IDMUserTileProps> {
e.stopPropagation();
console.log(e);
const asMember: Member = {
name: this.props.email,
userId: this.props.email,
name: this.props.email ?? "",
userId: this.props.email ?? "",
getMxcAvatarUrl: () => {
return "";
},
Expand Down Expand Up @@ -1082,6 +1082,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial

/* VERJI START */
private removeEmailInvite = (email: string | Member): void => {
if (this.state.busy) return;
const _email = (email as Member)?.name ?? (email as string);

const targets = this.state.targetEmails.map((t) => t); // cheap clone for mutation
Expand All @@ -1097,6 +1098,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
};
/* VERJI END */
private removeMember = (member: Member): void => {
if(this.state.busy) return;
const targets = this.state.targets.map((t) => t); // cheap clone for mutation
const idx = targets.indexOf(member);
if (idx >= 0) {
Expand Down Expand Up @@ -1389,14 +1391,14 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
if (this.allowOnboardingFlag) {
if (this.state.targetEmails?.length > 0) {
targets = this.state.targetEmails.map((t) => (
<DMEmailTile email={t} onRemove={!this.state.busy && this.removeEmailInvite} key={t ?? null} /> // ROSBERG
<DMEmailTile member={{} as Member} email={t} onRemove={this.removeEmailInvite} key={t ?? null} /> // ROSBERG
));
} else {
targets = this.state.targets.map((t) =>
t?.userId && t?.name ? (
<DMUserTile
member={t}
onRemove={!this.state.busy && this.removeMember}
onRemove={this.removeMember}
key={t?.userId ?? t?.name ?? null}
/>
) : null,
Expand All @@ -1407,7 +1409,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
t?.userId && t?.name ? (
<DMUserTile
member={t}
onRemove={!this.state.busy && this.removeMember}
onRemove={this.removeMember}
key={t?.userId ?? t?.name ?? null}
/>
) : null,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/direct-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class ThreepidMember extends Member {

export interface IDMUserTileProps {
member: Member; // VERJI
email: string; // VERJI
email?: string; // VERJI
onRemove?(member: Member | string): void; // VERJI
}

Expand Down

0 comments on commit d8300bc

Please sign in to comment.