Skip to content

Commit

Permalink
fix: cannot access current_user && bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Dim145 committed Apr 2, 2024
1 parent 1a74890 commit 34c41c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/models/activity_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ def self.dependant
end

def pre_destroy
unless @current_user.is_admin
# get current_user if destroy job called from a controller
current_user = RequestStore.read(:request)&.controller_instance&.current_user

# if user is not admin or destroy request not coming from a controller
unless current_user&.is_admin
set_status = Parameter.find_by(label: "activityApplication.default_status")

default_activity_status_id = set_status&.parse&.positive? ? set_status.parse : ActivityApplicationStatus::TREATMENT_PENDING_ID
Expand Down
2 changes: 1 addition & 1 deletion lib/elvis/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Elvis
VERSION = "2.2.11"
VERSION = "2.2.12"
end

0 comments on commit 34c41c4

Please sign in to comment.