Skip to content

Commit

Permalink
fix(regulations-admin): Actor to draft (#16356)
Browse files Browse the repository at this point in the history
* Actor to draft

* Fix propose btn styling

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
thordurhhh and kodiakhq[bot] authored Oct 10, 2024
1 parent dddbfb4 commit 8e82475
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
ShippedSummary,
TaskListType,
} from '@island.is/regulations/admin'
import { Kennitala, RegQueryName } from '@island.is/regulations'
import { Kennitala, MinistrySlug, RegQueryName } from '@island.is/regulations'
import * as kennitala from 'kennitala'
import { NationalRegistryV3ClientService } from '@island.is/clients/national-registry-v3'
import type { User } from '@island.is/auth-nest-tools'
Expand Down Expand Up @@ -255,13 +255,20 @@ export class DraftRegulationService {
): Promise<DraftRegulationModel> {
this.logger.debug('Creating a new DraftRegulation')

// If user is in delegation, use actor. Else use user.
let creatorNationalId = user?.nationalId
if (user?.actor) {
creatorNationalId = user.actor.nationalId
// If the user is in delegation from a valid ministry, add ministry to create?
}

const createData: Partial<DraftRegulationModel> = {
drafting_status: 'draft',
title: '',
text: '',
drafting_notes: '',
type: create.type,
authors: [user?.nationalId as Kennitala],
authors: [creatorNationalId as Kennitala],
}

return this.draftRegulationModel.create(createData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const SaveDeleteButtons = (props: SaveDeleteButtonsProps) => {
onClick={() => propose()}
icon="open"
iconType="outline"
variant="text"
variant="utility"
size="small"
disabled={saving}
>
Expand Down

0 comments on commit 8e82475

Please sign in to comment.