feat: include message context (if any) when reporting user

This commit is contained in:
Paul Makles 2023-05-31 12:06:31 +01:00
parent 7e87265ccb
commit 00708bb8f4
No known key found for this signature in database
GPG key ID: 5059F398521BB0F6
4 changed files with 9 additions and 1 deletions

View file

@ -63,6 +63,7 @@ const Message = observer(
? useTriggerEvents("Menu", {
user: message.author_id,
contextualChannel: message.channel_id,
contextualMessage: message._id,
// eslint-disable-next-line
})
: undefined;

View file

@ -41,6 +41,7 @@ const MessageContainer = styled.div`
*/
export default function ReportContent({
target,
messageId,
...props
}: ModalProps<"report">) {
const client = useClient();
@ -124,6 +125,7 @@ export default function ReportContent({
? "User"
: "Server",
report_reason: reason as any,
message_id: messageId,
},
additional_context,
});

View file

@ -182,6 +182,7 @@ export type Modal = {
| {
type: "report";
target: Server | User | Message;
messageId?: string;
}
| {
type: "report_success";

View file

@ -47,6 +47,7 @@ interface ContextMenuData {
unread?: boolean;
queued?: QueuedMessage;
contextualChannel?: string;
contextualMessage?: string;
}
type Action =
@ -112,7 +113,7 @@ type Action =
key: string;
state?: NotificationState;
}
| { action: "report"; target: User | Server | Message };
| { action: "report"; target: User | Server | Message; messageId?: string };
// ! FIXME: I dare someone to re-write this
// Tip: This should just be split into separate context menus per logical area.
@ -454,6 +455,7 @@ export default function ContextMenus() {
modalController.push({
type: "report",
target: data.target,
messageId: data.messageId,
});
break;
}
@ -478,6 +480,7 @@ export default function ContextMenus() {
queued,
unread,
contextualChannel: cxid,
contextualMessage,
}: ContextMenuData) => {
const elements: Children[] = [];
let lastDivider = false;
@ -682,6 +685,7 @@ export default function ContextMenus() {
{
action: "report",
target: user,
messageId: contextualMessage,
},
"report_user",
undefined,