Skip to content

Commit

Permalink
NoMethodError fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamelers committed Sep 14, 2024
1 parent ad903d7 commit 38d3ab0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/controllers/stash_datacite/resources_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ def submission

StashEngine.repository.submit(resource_id: @resource_id)

@resource.curation_activities << StashEngine::CurationActivity.create(status: 'processing', note: 'Repository processing data',
user_id: current_user.id)
@resource.curation_activities << StashEngine::CurationActivity.create(
status: 'processing', note: 'Repository processing data', user_id: current_user&.id || 0
)

@resource.reload

Expand Down
4 changes: 2 additions & 2 deletions app/policies/stash_engine/resource_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def curate?

def curator_edit?
(curate? &&
(@resource.current_resource_state.resource_state == 'submitted')) ||
(@resource.current_resource_state.resource_state == 'in_progress' && @resource.current_editor_id == @user.id)
(@resource.current_resource_state&.resource_state == 'submitted')) ||
(@resource.current_resource_state&.resource_state == 'in_progress' && @resource&.current_editor_id == @user.id)
end

class Scope
Expand Down

0 comments on commit 38d3ab0

Please sign in to comment.