4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/jobs/activate_project_job.rb', line 4
def perform(user:, project_id:)
project = Project.find(project_id)
raise "Invalid project id #{project_id} for job #{job_id}" if project.nil?
collection_id = project.mediaflux_id
project.activate!(collection_id: collection_id, current_user: user)
project.reload
return unless project.status != Project::ACTIVE_STATUS activation_failure_msg = "Project with #{collection_id} failed to activate due to mismatched DOI's between rails and mediaflux"
mailer = TigerdataMailer.with(project_id: project.id, user:, activation_failure_msg:)
message_delivery = mailer.project_activation
message_delivery.deliver_later
honeybadger_context = {
project_id: project.id,
project_metadata: project.metadata_model
}
Honeybadger.notify(activation_failure_msg, context: honeybadger_context)
end
|