mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 00:20:57 -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", {
|
? useTriggerEvents("Menu", {
|
||||||
user: message.author_id,
|
user: message.author_id,
|
||||||
contextualChannel: message.channel_id,
|
contextualChannel: message.channel_id,
|
||||||
|
contextualMessage: message._id,
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
})
|
})
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
|
@ -41,6 +41,7 @@ const MessageContainer = styled.div`
|
||||||
*/
|
*/
|
||||||
export default function ReportContent({
|
export default function ReportContent({
|
||||||
target,
|
target,
|
||||||
|
messageId,
|
||||||
...props
|
...props
|
||||||
}: ModalProps<"report">) {
|
}: ModalProps<"report">) {
|
||||||
const client = useClient();
|
const client = useClient();
|
||||||
|
@ -124,6 +125,7 @@ export default function ReportContent({
|
||||||
? "User"
|
? "User"
|
||||||
: "Server",
|
: "Server",
|
||||||
report_reason: reason as any,
|
report_reason: reason as any,
|
||||||
|
message_id: messageId,
|
||||||
},
|
},
|
||||||
additional_context,
|
additional_context,
|
||||||
});
|
});
|
||||||
|
|
|
@ -182,6 +182,7 @@ export type Modal = {
|
||||||
| {
|
| {
|
||||||
type: "report";
|
type: "report";
|
||||||
target: Server | User | Message;
|
target: Server | User | Message;
|
||||||
|
messageId?: string;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "report_success";
|
type: "report_success";
|
||||||
|
|
|
@ -47,6 +47,7 @@ interface ContextMenuData {
|
||||||
unread?: boolean;
|
unread?: boolean;
|
||||||
queued?: QueuedMessage;
|
queued?: QueuedMessage;
|
||||||
contextualChannel?: string;
|
contextualChannel?: string;
|
||||||
|
contextualMessage?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Action =
|
type Action =
|
||||||
|
@ -112,7 +113,7 @@ type Action =
|
||||||
key: string;
|
key: string;
|
||||||
state?: NotificationState;
|
state?: NotificationState;
|
||||||
}
|
}
|
||||||
| { action: "report"; target: User | Server | Message };
|
| { action: "report"; target: User | Server | Message; messageId?: string };
|
||||||
|
|
||||||
// ! FIXME: I dare someone to re-write this
|
// ! FIXME: I dare someone to re-write this
|
||||||
// Tip: This should just be split into separate context menus per logical area.
|
// Tip: This should just be split into separate context menus per logical area.
|
||||||
|
@ -454,6 +455,7 @@ export default function ContextMenus() {
|
||||||
modalController.push({
|
modalController.push({
|
||||||
type: "report",
|
type: "report",
|
||||||
target: data.target,
|
target: data.target,
|
||||||
|
messageId: data.messageId,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -478,6 +480,7 @@ export default function ContextMenus() {
|
||||||
queued,
|
queued,
|
||||||
unread,
|
unread,
|
||||||
contextualChannel: cxid,
|
contextualChannel: cxid,
|
||||||
|
contextualMessage,
|
||||||
}: ContextMenuData) => {
|
}: ContextMenuData) => {
|
||||||
const elements: Children[] = [];
|
const elements: Children[] = [];
|
||||||
let lastDivider = false;
|
let lastDivider = false;
|
||||||
|
@ -682,6 +685,7 @@ export default function ContextMenus() {
|
||||||
{
|
{
|
||||||
action: "report",
|
action: "report",
|
||||||
target: user,
|
target: user,
|
||||||
|
messageId: contextualMessage,
|
||||||
},
|
},
|
||||||
"report_user",
|
"report_user",
|
||||||
undefined,
|
undefined,
|
||||||
|
|
Loading…
Reference in a new issue