Fix pull request comments
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -9,17 +9,14 @@ import {
|
||||
} from "react-relay";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { toast } from "@/hooks/use-toast";
|
||||
import { Suspense } from "react";
|
||||
import PeopleSelector from "@/components/PeopleSelector";
|
||||
import type { EditPolicyViewQuery } from "./__generated__/EditPolicyViewQuery.graphql";
|
||||
import type { EditPolicyViewMutation as EditPolicyViewMutationType } from "./__generated__/EditPolicyViewMutation.graphql";
|
||||
import { PageTemplate } from "@/components/PageTemplate";
|
||||
import { EditPolicyViewSkeleton } from "./EditPolicyPage";
|
||||
import { User } from "lucide-react";
|
||||
|
||||
const editPolicyViewQuery = graphql`
|
||||
query EditPolicyViewQuery($policyId: ID!, $organizationId: ID!, $policyVersionId: ID!) {
|
||||
|
||||
@@ -38,11 +38,8 @@ import {
|
||||
DialogTitle,
|
||||
DialogDescription,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Avatar } from "@/components/ui/avatar";
|
||||
import { cn } from "@/lib/utils";
|
||||
import PeopleSelector from "@/components/PeopleSelector";
|
||||
import type { PeopleSelector_organization$key } from "@/components/__generated__/PeopleSelector_organization.graphql";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
|
||||
const policyListViewQuery = graphql`
|
||||
@@ -363,7 +360,7 @@ function CreatePolicyModal({
|
||||
className={`text-4xl leading-tight font-bold outline-none focus:outline-none ${!title ? 'text-gray-400' : 'text-black'}`}
|
||||
contentEditable
|
||||
suppressContentEditableWarning
|
||||
onBlur={(e) => setTitle(e.currentTarget.textContent || "")}
|
||||
onInput={(e) => setTitle(e.currentTarget.textContent || "")}
|
||||
style={{ WebkitTapHighlightColor: 'transparent' }}
|
||||
onClick={(e) => {
|
||||
if (!title) {
|
||||
|
||||
@@ -33,7 +33,7 @@ SELECT
|
||||
p.tenant_id,
|
||||
p.id,
|
||||
1,
|
||||
'',
|
||||
p.content,
|
||||
'Initial version',
|
||||
p.owner_id,
|
||||
'DRAFT',
|
||||
@@ -56,5 +56,5 @@ SET current_published_version = 1
|
||||
WHERE EXISTS (
|
||||
SELECT 1 FROM policy_versions pv
|
||||
WHERE pv.policy_id = p.id
|
||||
AND pv.status = 'published'
|
||||
AND pv.status = 'PUBLISHED'
|
||||
);
|
||||
|
||||
@@ -189,7 +189,7 @@ INSERT INTO policy_versions (
|
||||
"content": p.Content,
|
||||
"changelog": p.Changelog,
|
||||
"created_by": p.CreatedBy,
|
||||
"status": PolicyStatusDraft,
|
||||
"status": p.Status,
|
||||
"created_at": now,
|
||||
"updated_at": now,
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func (pvs *PolicyVersionSignatureState) UnmarshalText(data []byte) error {
|
||||
case PolicyVersionSignatureStateSigned.String():
|
||||
*pvs = PolicyVersionSignatureStateSigned
|
||||
default:
|
||||
return fmt.Errorf("invalid MesureState value: %q", val)
|
||||
return fmt.Errorf("invalid PolicyVersionSignatureState value: %q", val)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -55,6 +55,8 @@ func (pvs PolicyVersionSignatureState) String() string {
|
||||
val = "REQUESTED"
|
||||
case PolicyVersionSignatureStateSigned:
|
||||
val = "SIGNED"
|
||||
default:
|
||||
panic(fmt.Errorf("invalid PolicyVersionSignatureState value: %q", string(pvs)))
|
||||
}
|
||||
|
||||
return val
|
||||
@@ -63,7 +65,7 @@ func (pvs PolicyVersionSignatureState) String() string {
|
||||
func (pvs *PolicyVersionSignatureState) Scan(value any) error {
|
||||
val, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid scan source for MesureState, expected string got %T", value)
|
||||
return fmt.Errorf("invalid scan source for PolicyVersionSignatureState, expected string got %T", value)
|
||||
}
|
||||
|
||||
return pvs.UnmarshalText([]byte(val))
|
||||
|
||||
@@ -136,6 +136,7 @@ func (s *PolicyService) Create(
|
||||
PolicyID: policyID,
|
||||
VersionNumber: 1,
|
||||
Content: req.Content,
|
||||
Status: coredata.PolicyStatusDraft,
|
||||
CreatedBy: req.CreatedBy,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
@@ -147,7 +148,7 @@ func (s *PolicyService) Create(
|
||||
return fmt.Errorf("cannot insert policy: %w", err)
|
||||
}
|
||||
|
||||
if err := policyVersion.Update(ctx, conn, s.svc.scope); err != nil {
|
||||
if err := policyVersion.Insert(ctx, conn, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot create policy version: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user