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