Added group_call_rageshake_request_id for rageshake grouping
This commit is contained in:
parent
942630c2fc
commit
4168540017
3 changed files with 33 additions and 10 deletions
|
@ -4,6 +4,7 @@ import { Button } from "../button";
|
|||
import { FieldRow, InputField, ErrorMessage } from "../input/Input";
|
||||
import { useSubmitRageshake, useRageshakeRequest } from "../settings/rageshake";
|
||||
import { Body } from "../typography/Typography";
|
||||
import { randomString } from "matrix-js-sdk/src/randomstring";
|
||||
|
||||
export function FeedbackModal({ inCall, roomId, ...rest }) {
|
||||
const { submitRageshake, sending, sent, error } = useSubmitRageshake();
|
||||
|
@ -15,10 +16,16 @@ export function FeedbackModal({ inCall, roomId, ...rest }) {
|
|||
const data = new FormData(e.target);
|
||||
const description = data.get("description");
|
||||
const sendLogs = data.get("sendLogs");
|
||||
submitRageshake({ description, sendLogs });
|
||||
const rageshakeRequestId = randomString(16);
|
||||
|
||||
submitRageshake({
|
||||
description,
|
||||
sendLogs,
|
||||
rageshakeRequestId,
|
||||
});
|
||||
|
||||
if (inCall && sendLogs) {
|
||||
sendRageshakeRequest(roomId);
|
||||
sendRageshakeRequest(roomId, rageshakeRequestId);
|
||||
}
|
||||
},
|
||||
[inCall, submitRageshake, roomId, sendRageshakeRequest]
|
||||
|
|
|
@ -5,17 +5,17 @@ import { FieldRow, ErrorMessage } from "../input/Input";
|
|||
import { useSubmitRageshake } from "../settings/rageshake";
|
||||
import { Body } from "../typography/Typography";
|
||||
|
||||
export function RageshakeRequestModal(props) {
|
||||
export function RageshakeRequestModal({ rageshakeRequestId, ...rest }) {
|
||||
const { submitRageshake, sending, sent, error } = useSubmitRageshake();
|
||||
|
||||
useEffect(() => {
|
||||
if (sent) {
|
||||
props.onClose();
|
||||
rest.onClose();
|
||||
}
|
||||
}, [sent, props.onClose]);
|
||||
}, [sent, rest.onClose]);
|
||||
|
||||
return (
|
||||
<Modal title="Debug Log Request" isDismissable {...props}>
|
||||
<Modal title="Debug Log Request" isDismissable {...rest}>
|
||||
<ModalContent>
|
||||
<Body>
|
||||
Another user on this call is having an issue. In order to better
|
||||
|
@ -23,7 +23,12 @@ export function RageshakeRequestModal(props) {
|
|||
</Body>
|
||||
<FieldRow>
|
||||
<Button
|
||||
onPress={() => submitRageshake({ sendLogs: true })}
|
||||
onPress={() =>
|
||||
submitRageshake({
|
||||
sendLogs: true,
|
||||
rageshakeRequestId,
|
||||
})
|
||||
}
|
||||
disabled={sending}
|
||||
>
|
||||
{sending ? "Sending debug log..." : "Send debug log"}
|
||||
|
|
|
@ -194,6 +194,13 @@ export function useSubmitRageshake() {
|
|||
}
|
||||
}
|
||||
|
||||
if (opts.rageshakeRequestId) {
|
||||
body.append(
|
||||
"group_call_rageshake_request_id",
|
||||
opts.rageshakeRequestId
|
||||
);
|
||||
}
|
||||
|
||||
await fetch(
|
||||
import.meta.env.VITE_RAGESHAKE_SUBMIT_URL ||
|
||||
"https://element.io/bugreports/submit",
|
||||
|
@ -245,8 +252,10 @@ export function useRageshakeRequest() {
|
|||
const { client } = useClient();
|
||||
|
||||
const sendRageshakeRequest = useCallback(
|
||||
(roomId) => {
|
||||
client.sendEvent(roomId, "org.matrix.rageshake_request", {});
|
||||
(roomId, rageshakeRequestId) => {
|
||||
client.sendEvent(roomId, "org.matrix.rageshake_request", {
|
||||
request_id: rageshakeRequestId,
|
||||
});
|
||||
},
|
||||
[client]
|
||||
);
|
||||
|
@ -257,6 +266,7 @@ export function useRageshakeRequest() {
|
|||
export function useRageshakeRequestModal(roomId) {
|
||||
const { modalState, modalProps } = useModalTriggerState();
|
||||
const { client } = useClient();
|
||||
const [rageshakeRequestId, setRageshakeRequestId] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
const onEvent = (event) => {
|
||||
|
@ -267,6 +277,7 @@ export function useRageshakeRequestModal(roomId) {
|
|||
roomId === event.getRoomId() &&
|
||||
client.getUserId() !== event.getSender()
|
||||
) {
|
||||
setRageshakeRequestId(event.getContent().request_id);
|
||||
modalState.open();
|
||||
}
|
||||
};
|
||||
|
@ -278,5 +289,5 @@ export function useRageshakeRequestModal(roomId) {
|
|||
};
|
||||
}, [modalState.open, roomId]);
|
||||
|
||||
return { modalState, modalProps };
|
||||
return { modalState, modalProps: { ...modalProps, rageshakeRequestId } };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue