ITHC: enforce representation completion ownership and admin access
This commit is contained in:
@@ -3,7 +3,6 @@ import { useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { bytesToSize } from "../../../components/utils";
|
||||
import { deleteAwaitingSubmissionsFromBlob } from "../../../actions/services/documentService";
|
||||
import { sendRepCompleteMessage } from "../../../actions/services/portalService";
|
||||
import { consoleLogger } from "../../../actions/core/logger";
|
||||
|
||||
import { formatBlobDates } from "../utils/adminHelper";
|
||||
@@ -237,7 +236,8 @@ export default function StorageTab({ data, repCompleteCount }) {
|
||||
{folder.repComplete && (
|
||||
<button
|
||||
onClick={async () => {
|
||||
confirm(
|
||||
if (
|
||||
!confirm(
|
||||
"Do you want resend the rep queue message " +
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
@@ -246,20 +246,53 @@ export default function StorageTab({ data, repCompleteCount }) {
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
) &&
|
||||
(sendRepCompleteMessage(
|
||||
c.container,
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0],
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
),
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response =
|
||||
await fetch(
|
||||
"/api/admin/createrepcompletemessage",
|
||||
{
|
||||
method: "POST",
|
||||
headers:
|
||||
{
|
||||
"Content-Type":
|
||||
"application/json"
|
||||
},
|
||||
body: JSON.stringify(
|
||||
{
|
||||
container:
|
||||
c.container,
|
||||
tempcaseref:
|
||||
folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[0],
|
||||
repid: folder.repJsonBlob.name.split(
|
||||
"/"
|
||||
)[1]
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
"Unable to recreate representation queue message"
|
||||
);
|
||||
}
|
||||
|
||||
alert(
|
||||
"rep queue message sent!"
|
||||
),
|
||||
window.location.reload());
|
||||
);
|
||||
window.location.reload();
|
||||
} catch (error) {
|
||||
consoleLogger(
|
||||
error
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Recreate Queue Message
|
||||
|
||||
Reference in New Issue
Block a user