mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 14:40:58 -05:00
feat: include message context (if any) when reporting user
This commit is contained in:
parent
7e87265ccb
commit
00708bb8f4
4 changed files with 9 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -182,6 +182,7 @@ export type Modal = {
|
|||
| {
|
||||
type: "report";
|
||||
target: Server | User | Message;
|
||||
messageId?: string;
|
||||
}
|
||||
| {
|
||||
type: "report_success";
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue