mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 02:04:33 +08:00
Fixed updating user assignment in MyModuleMember [SCI-6169]
This commit is contained in:
parent
35eb7bffdd
commit
6249465b34
1 changed files with 3 additions and 3 deletions
|
@ -22,7 +22,7 @@ class MyModuleMember
|
|||
end
|
||||
|
||||
def update(params)
|
||||
user_assignment(params)
|
||||
initialize_user_assignment!(params)
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
user_assignment.update!(user_role: user_role, assigned: :manually)
|
||||
|
@ -32,13 +32,13 @@ class MyModuleMember
|
|||
|
||||
private
|
||||
|
||||
def user_assignment(params)
|
||||
def initialize_user_assignment!(params)
|
||||
self.user_role_id = params[:user_role_id]
|
||||
self.user_id = params[:user_id]
|
||||
|
||||
@user = @project.users.find(user_id)
|
||||
@user_role = UserRole.find_by(id: user_role_id)
|
||||
@user_assignment ||= UserAssignment.find_by(assignable: my_module, user: user)
|
||||
@user_assignment = UserAssignment.find_by(assignable: my_module, user: user)
|
||||
end
|
||||
|
||||
def log_change_activity
|
||||
|
|
Loading…
Reference in a new issue