From 178b8d6a9f6f174c0d699f04b1c111bc0fc9212c Mon Sep 17 00:00:00 2001 From: Jack Brinkman Date: Fri, 15 Dec 2023 10:30:43 +1000 Subject: [PATCH] Added userId check to toggleDraftMode method --- gradle.properties | 2 +- .../services/au/org/ala/profile/ProfileService.groovy | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 67eafea..5c52ae5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -profileServiceVersion=5.2-SNAPSHOT +profileServiceVersion=5.2.2-SNAPSHOT grailsVersion=5.2.4 gorm.version=7.3.2 groovyVersion=3.0.11 diff --git a/grails-app/services/au/org/ala/profile/ProfileService.groovy b/grails-app/services/au/org/ala/profile/ProfileService.groovy index 74f9644..7030667 100644 --- a/grails-app/services/au/org/ala/profile/ProfileService.groovy +++ b/grails-app/services/au/org/ala/profile/ProfileService.groovy @@ -610,7 +610,12 @@ class ProfileService extends BaseDataAccessService { save profile } else { profile.draft = profile.draft ?: CloneAndDraftUtil.createDraft(profile) - profile.draft.createdBy = userService.getUserForUserId(userService.getUserId()).displayName + + if (userService.getUserId()) { + profile.draft.createdBy = userService.getUserForUserId(userService.getUserId()).displayName + } else { + log.debug("No user ID when switching profile to draft") + } save profile }