From 1498266969b87ee14425d731458099714b94bef3 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 31 Jul 2019 19:16:41 +0800 Subject: [PATCH] fix join project apply api --- app/services/projects/apply_join_service.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/services/projects/apply_join_service.rb b/app/services/projects/apply_join_service.rb index a177de930..d14b3dc52 100644 --- a/app/services/projects/apply_join_service.rb +++ b/app/services/projects/apply_join_service.rb @@ -22,7 +22,7 @@ class Projects::ApplyJoinService < ApplicationService apply.forge_activities.find_or_create_by!(user: user, project: project) - notify_project_manager! + notify_project_manager!(apply) end # notify_project_owner @@ -47,10 +47,13 @@ class Projects::ApplyJoinService < ApplicationService end end - def notify_project_manager! + def notify_project_manager!(apply) columns = %i[user_id applied_id applied_type status viewed applied_user_id role project_id created_at updated_at] AppliedMessage.bulk_insert(*columns) do |worker| - base_attr = { status: false, viewed: false, applied_user_id: user.id, role: role_value, project_id: project.id } + base_attr = { + applied_id: apply.id, applied_type: 'AppliedProject', status: false, viewed: false, + applied_user_id: user.id, role: role_value, project_id: project.id + } project.manager_members.each do |manager| worker.add(base_attr.merge(user_id: manager.user_id))