diff --git a/app/controllers/concerns/scholars_archive/articles_controller_behavior.rb b/app/controllers/concerns/scholars_archive/articles_controller_behavior.rb
deleted file mode 100644
index 6482312e3..000000000
--- a/app/controllers/concerns/scholars_archive/articles_controller_behavior.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-module ScholarsArchive
- # Article controller behavior
- module ArticlesControllerBehavior
- # MODIFY: Add in a way to send email after create success
- def create
- set_other_option_values
- work_persist = super
- article_email_info if work_persist
- work_persist
- end
-
- # METHOD: A function to get the info to send out to the depositor on their article
- def article_email_info
- # VARIABLE: Create a hash to pass the data into mail
- article_email = { title: curation_concern.title,
- creator: curation_concern.depositor,
- article_id: curation_concern.id,
- link_url: main_app.polymorphic_url(curation_concern) }
-
- # SEND: Send the email out to the depositor
- send_email_on_article(article_email)
- end
-
- # METHOD: Send out email to the depositor let them know it is deposited
- def send_email_on_article(email_data)
- # MAILER: Enable mailer so it can send out the email
- ActionMailer::Base.perform_deliveries = true
-
- # USER: Get user email to send out
- email_recipient = User.where(username: curation_concern.depositor).map(&:email).join
-
- # DELIVER: Delivering the email to the reviewer
- ScholarsArchive::ArticlesNotificationMailer.with(user_email: email_recipient, data: email_data).email_article_depositor.deliver_now
- end
- end
-end
diff --git a/app/controllers/hyrax/articles_controller.rb b/app/controllers/hyrax/articles_controller.rb
index ae7a58470..64660bb3d 100644
--- a/app/controllers/hyrax/articles_controller.rb
+++ b/app/controllers/hyrax/articles_controller.rb
@@ -8,7 +8,6 @@ module Hyrax
class ArticlesController < ApplicationController
# Adds Hyrax behaviors to the controller.
include ScholarsArchive::WorksControllerBehavior
- include ScholarsArchive::ArticlesControllerBehavior
include ScholarsArchive::RedirectIfRestrictedBehavior
include Hyrax::BreadcrumbsForWorks
self.curation_concern_type = Article
diff --git a/app/mailers/scholars_archive/articles_notification_mailer.rb b/app/mailers/scholars_archive/articles_notification_mailer.rb
deleted file mode 100644
index 31cfb6e94..000000000
--- a/app/mailers/scholars_archive/articles_notification_mailer.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-module ScholarsArchive
- # MAILER: A article mailer application
- class ArticlesNotificationMailer < ApplicationMailer
- # METHOD: Create an email and send a report to the reviewer
- def email_article_depositor
- # FETCH: Get the information to connect to the mailer
- @article_data = params[:data]
- @user_email = params[:user_email]
-
- # MAIL: Email out to couple recipients
- mail(to: @user_email, subject: '[Scholars Archive] - Article Deposit Notice')
- end
- end
-end
diff --git a/app/services/scholars_archive/workflow/deposit_received_notification.rb b/app/services/scholars_archive/workflow/deposit_received_notification.rb
index 27bfca555..50e7353fc 100644
--- a/app/services/scholars_archive/workflow/deposit_received_notification.rb
+++ b/app/services/scholars_archive/workflow/deposit_received_notification.rb
@@ -14,7 +14,17 @@ def subject
# rubocop:disable Metrics/MethodLength
# rubocop:disable Lint/Void
def message
- if !SolrDocument.find(work_id)['resource_type_tesim']&.include?('Dataset')
+ if SolrDocument.find(work_id)['resource_type_tesim']&.include?('Article')
+ "ScholarsArchive@OSU has received your deposit: #{title}
+
+ The citable URL for your article is: #{link_to citeable_url, citeable_url}
+
+ If you have questions, please respond to this email.
+
+ Thank you,
+
+ ScholarsArchive@OSU Admin"
+ elsif !SolrDocument.find(work_id)['resource_type_tesim']&.include?('Dataset')
"ScholarsArchive@OSU has received your deposit: #{title} (#{link_to work_id, citeable_url}). Your item is under review by repository administrators. You will be notified if your deposit requires additional changes and/or when your deposit is live in the repository. \n\n #{comment}"
else
"ScholarsArchive@OSU has received your deposit: #{title} (#{link_to work_id, citeable_url}). Your item is under review by repository administrators. You will be notified if your deposit requires additional changes and/or when your deposit is live in the repository.
diff --git a/app/views/scholars_archive/articles_notification_mailer/email_article_depositor.html.erb b/app/views/scholars_archive/articles_notification_mailer/email_article_depositor.html.erb
deleted file mode 100644
index 81466d6d8..000000000
--- a/app/views/scholars_archive/articles_notification_mailer/email_article_depositor.html.erb
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
Hi there, thank you for submitting an article work to Scholars Archive. Below you is a - confirmation infomation on your submission and your own personal URL where your article - is located. -
- -Confirmation Deposit:
-Article's Title - <%= @article_data[:title] %>
-Depositor - <%= @article_data[:creator] %>
-Article's ID - <%= @article_data[:article_id] %>
- -Link to Deposited Article:
-pURL: <%= @article_data[:link_url] %>
- -- Scholars Archive Support
- - \ No newline at end of file diff --git a/config/workflows/self_deposit.json b/config/workflows/self_deposit.json index 8852d2807..b8e1e036b 100644 --- a/config/workflows/self_deposit.json +++ b/config/workflows/self_deposit.json @@ -7,6 +7,11 @@ "name": "Deposit", "from_states": [], "transition_to": "Deposited", + "notifications": [{ + "notification_type": "email", + "name": "ScholarsArchive::Workflow::DepositReceivedNotification", + "to": ["depositing"] + }], "methods": [ "Hyrax::Workflow::GrantEditToDepositor", "Hyrax::Workflow::ActivateObject" diff --git a/spec/mailers/scholars_archive/articles_notification_mailer_spec.rb b/spec/mailers/scholars_archive/articles_notification_mailer_spec.rb deleted file mode 100644 index 1e8ed8fcb..000000000 --- a/spec/mailers/scholars_archive/articles_notification_mailer_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal:true - -# RSPEC: Create a testing environment to Articles Notification Mailer class -RSpec.describe ScholarsArchive::ArticlesNotificationMailer do - include ActionView::Helpers::UrlHelper - # VARIABLES: Create couple variables for testing purpose on mailer - let(:tst) do - { title: 'Article Test', - creator: 'test_depositor', - dataset_id: 'fe3452', - link_url: 'https://test.com/' } - end - let(:mail) { described_class.with(data: tst).email_article_depositor } - - # TEST GROUP #1: Create a test to see if the mailer class pass the test on subject heading - it { expect(mail.subject).to eql('[Scholars Archive] - Article Deposit Notice') } - - # TEST GROUP #2: Create couple test to see if the view mailer hold the exact same data - it { expect(mail.body.encoded).to include("Article's Title - #{tst[:title]}") } - it { expect(mail.body.encoded).to include("Article's ID - #{tst[:article_id]}") } - it { expect(mail.body.encoded).to include("Depositor - #{tst[:creator]}") } - it { expect(mail.body.encoded).to include("pURL: #{tst[:link_url]}") } -end