mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 18:30:39 +09:00
Add generic issue-linked board approvals
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
3264f9c1f6
commit
372421ef0b
1 changed files with 33 additions and 1 deletions
|
|
@ -742,6 +742,39 @@ export function IssueDetail() {
|
|||
},
|
||||
});
|
||||
|
||||
const approvalDecision = useMutation({
|
||||
mutationFn: async ({ approvalId, action }: { approvalId: string; action: "approve" | "reject" }) => {
|
||||
if (action === "approve") {
|
||||
return approvalsApi.approve(approvalId);
|
||||
}
|
||||
return approvalsApi.reject(approvalId);
|
||||
},
|
||||
onMutate: ({ approvalId, action }) => {
|
||||
setPendingApprovalAction({ approvalId, action });
|
||||
},
|
||||
onSuccess: (_approval, variables) => {
|
||||
invalidateIssue();
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.approvals.detail(variables.approvalId) });
|
||||
if (resolvedCompanyId) {
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.approvals.list(resolvedCompanyId) });
|
||||
}
|
||||
pushToast({
|
||||
title: variables.action === "approve" ? "Approval approved" : "Approval rejected",
|
||||
tone: "success",
|
||||
});
|
||||
},
|
||||
onError: (err, variables) => {
|
||||
pushToast({
|
||||
title: variables.action === "approve" ? "Approval failed" : "Rejection failed",
|
||||
body: err instanceof Error ? err.message : "Unable to update approval",
|
||||
tone: "error",
|
||||
});
|
||||
},
|
||||
onSettled: () => {
|
||||
setPendingApprovalAction(null);
|
||||
},
|
||||
});
|
||||
|
||||
const addComment = useMutation({
|
||||
mutationFn: ({ body, reopen, interrupt }: { body: string; reopen?: boolean; interrupt?: boolean }) =>
|
||||
issuesApi.addComment(issueId!, body, reopen, interrupt),
|
||||
|
|
@ -1892,7 +1925,6 @@ export function IssueDetail() {
|
|||
)}
|
||||
</Tabs>
|
||||
|
||||
|
||||
{/* Mobile properties drawer */}
|
||||
<Sheet open={mobilePropsOpen} onOpenChange={setMobilePropsOpen}>
|
||||
<SheetContent side="bottom" className="max-h-[85dvh] pb-[env(safe-area-inset-bottom)]">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue