Skip to content

Commit

Permalink
Merge a08775b into 5185a20
Browse files Browse the repository at this point in the history
  • Loading branch information
bess authored Nov 17, 2017
2 parents 5185a20 + a08775b commit 58841f9
Show file tree
Hide file tree
Showing 34 changed files with 159 additions and 101 deletions.
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export HYRAX_HOST=localhost
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ coverage

# Ignore local browse-everything configs
config/browse_everything_providers.yml


# Don't check dotenv files into github
.env
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ gem 'clamby', '>= 1.2.5'
gem 'coffee-rails'
gem 'devise'
gem 'devise-guests', '~> 0.5'

gem 'dotenv'
gem 'dotenv-rails'
gem 'factory_girl_rails' # Needed so we can load fixtures for demos in production
gem 'ffaker' # Needed so we can load fixtures for demos in production
gem 'hydra-role-management'
Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ GEM
devise
diff-lcs (1.3)
docile (1.1.5)
dotenv (2.2.1)
dotenv-rails (2.2.1)
dotenv (= 2.2.1)
railties (>= 3.2, < 5.2)
dropbox-sdk (1.6.5)
json
dry-configurable (0.7.0)
Expand Down Expand Up @@ -902,6 +906,8 @@ DEPENDENCIES
database_cleaner
devise
devise-guests (~> 0.5)
dotenv
dotenv-rails
factory_girl_rails
fcrepo_wrapper
ffaker
Expand Down
10 changes: 10 additions & 0 deletions app/mailers/test_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class TestMailer < ApplicationMailer
def test_email
mail(
from: "bess@curationexperts.com",
to: "bess@curationexperts.com",
subject: "Test mail",
body: "Test mail body"
)
end
end
6 changes: 6 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,10 @@ def self.from_omniauth(auth)
def to_s
uid
end

# Mailboxer (the notification system) needs the User object to respond to this method
# in order to send emails
def mailboxer_email(_object)
email
end
end
19 changes: 12 additions & 7 deletions app/services/hyrax/workflow/approved_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ def workflow_recipients
{ "to" => (approvers << depositor) }
end

private
def subject
"Deposit #{title} has been approved"
end

def message
"The work titled \"#{title}\" has been approved by #{user.display_name}.
def subject
"Deposit #{title} has been approved"
end
Comments (if any):
#{comment}
def message
"#{title} (#{link_to work_id, document_path}) has been approved by #{user.display_name} #{comment}"
end
You can view the work in the Emory Electronic Thesis and Dissertation system at
#{link_to document_url, document_url}
"
end
end
end
end
14 changes: 6 additions & 8 deletions app/services/hyrax/workflow/changes_required_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ def workflow_recipients
{ "to" => (approvers << depositor) }
end

protected

def subject
"Deposit #{title} requires changes"
end
def subject
"Deposit #{title} requires changes"
end

def message
"#{title} (#{link_to work_id, document_path}) requires additional changes before approval.\n\n '#{comment}'"
end
def message
"#{title} (#{link_to work_id, document_url}) requires additional changes before approval.\n\n '#{comment}'"
end
end
end
end
14 changes: 6 additions & 8 deletions app/services/hyrax/workflow/comment_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ def workflow_recipients
{ "to" => (approvers << depositor) }
end

private

def subject
'Comment on Deposit'
end
def subject
"Comment on Deposit"
end

def message
"#{user.display_name} has added a comment to #{title} (#{link_to work_id, document_path}) \n\n #{comment}"
end
def message
"#{user.display_name} has added a comment to #{title} (#{link_to work_id, document_url}): \n\n #{comment}"
end
end
end
end
14 changes: 6 additions & 8 deletions app/services/hyrax/workflow/degree_awarded_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ def workflow_recipients
{ "to" => (approvers << depositor) }
end

private

def subject
"Degree awarded for #{title}"
end
def subject
"Degree awarded for #{title}"
end

def message
"The degree associated with #{title} (#{link_to work_id, document_path}) has been awarded."
end
def message
"The degree associated with #{title} (#{link_to work_id, document_url}) has been awarded."
end
end
end
end
20 changes: 9 additions & 11 deletions app/services/hyrax/workflow/hidden_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ def workflow_recipients
{ "to" => (approvers << depositor) }
end

private

def subject
'Deposit has been hidden'
end
def subject
'Deposit has been hidden'
end

def message
"#{title} (#{link_to work_id, document_path}) was hidden by #{user.display_name} #{comment}"
end
def message
"#{title} (#{link_to work_id, document_url}) was hidden by #{user.display_name} #{comment}"
end

def users_to_notify
super << user
end
def users_to_notify
super << user
end
end
end
end
7 changes: 7 additions & 0 deletions app/services/hyrax/workflow/laevigata_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ def title
original_title.length > max ? "#{original_title[0...max]}..." : original_title
end

# Get the full URL for email notifications
# This should get pushed upstream to Hyrax
def document_url
key = document.model_name.singular_route_key
Rails.application.routes.url_helpers.send(key + "_url", document.id)
end

def workflow_recipients
raise NotImplementedError, "Implement workflow_recipients in a child class"
end
Expand Down
14 changes: 6 additions & 8 deletions app/services/hyrax/workflow/pending_approval_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ def workflow_recipients
{ "to" => (approvers << depositor) }
end

private

def subject
"Deposit #{title} is awaiting approval"
end
def subject
"Deposit #{title} is awaiting approval"
end

def message
"#{title} (#{link_to work_id, document_path}) was deposited by #{user.display_name} and is awaiting approval. #{comment}"
end
def message
"#{title} (#{link_to work_id, document_url}) was deposited by #{user.display_name} and is awaiting approval. #{comment}"
end
end
end
end
14 changes: 6 additions & 8 deletions app/services/hyrax/workflow/pending_review_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ def workflow_recipients
{ "to" => (reviewers << depositor) }
end

private

def subject
'Deposit needs review'
end
def subject
'Deposit needs review'
end

def message
"#{title} (#{link_to work_id, document_path}) was deposited by #{user.display_name} and is awaiting initial review. #{comment}"
end
def message
"#{title} (#{link_to work_id, document_url}) was deposited by #{user.display_name} and is awaiting initial review. #{comment}"
end
end
end
end
20 changes: 9 additions & 11 deletions app/services/hyrax/workflow/published_notification.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
module Hyrax
module Workflow
class PublishedNotification < AbstractNotification
private
def subject
'Deposit reviewed and published'
end

def subject
'Deposit reviewed and published'
end
def message
"#{title} (#{link_to work_id, document_url}) was published by #{user.display_name} #{comment}"
end

def message
"#{title} (#{link_to work_id, document_path}) was published by #{user.display_name} #{comment}"
end

def users_to_notify
super << user
end
def users_to_notify
super << user
end
end
end
end
14 changes: 6 additions & 8 deletions app/services/hyrax/workflow/reviewed_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ def workflow_recipients
{ "to" => (reviewers << depositor) }
end

private

def subject
'Deposit reviewed and ready for final approval'
end
def subject
'Deposit reviewed and ready for final approval'
end

def message
"#{title} (#{link_to work_id, document_path}) has completed initial review and is awaiting final approval. #{comment}"
end
def message
"#{title} (#{link_to work_id, document_url}) has completed initial review and is awaiting final approval. #{comment}"
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def subject
def message
"Dear #{user.display_name},\n\n" \
"The embargo on your dissertation or thesis, #{title}, will expire in seven days.\n" \
"Your dissertation or thesis can be accessed in the Emory University ETD Repository at: (#{link_to document_path, document_path}) \n\n" \
"Your dissertation or thesis can be accessed in the Emory University ETD Repository at: #{link_to document_url, document_url} \n\n" \
"If you need your record to remain restricted/embargoed, please contact etd-help@listserv.cc.emory.edu<mailto:etd-help@listserv.cc.emory.edu> with your request. \n\n" \
"Please do not reply directy to this email.\n\n" \

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def subject
def message
"Dear #{user.display_name},\n\n" \
"The embargo on your dissertation or thesis, #{title}, will expire in sixty days.\n" \
"Your dissertation or thesis can be accessed in the Emory University ETD Repository at: (#{link_to document_path, document_path}) \n\n" \
"Your dissertation or thesis can be accessed in the Emory University ETD Repository at: #{link_to document_url, document_url} \n\n" \
"If you need your record to remain restricted/embargoed, please contact etd-help@listserv.cc.emory.edu<mailto:etd-help@listserv.cc.emory.edu> with your request. \n\n" \
"Please do not reply directy to this email.\n\n" \

Expand Down
2 changes: 1 addition & 1 deletion app/services/hyrax/workflow/today_embargo_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def message
"The access restriction on your disseration or thesis, #{title}, expires today." \
"We have not been informed that you wish to extend your access restriction period " \
"and therefore your dissertation or thesis is now available in full text form in our repository.\n\n" \
"Your dissertation or thesis can be accessed in the Emory University ETD Repository at: (#{link_to document_path, document_path}) \n\n" \
"Your dissertation or thesis can be accessed in the Emory University ETD Repository at: #{link_to document_url, document_url} \n\n" \
"If you need your record to remain restricted/embargoed, please contact etd-help@listserv.cc.emory.edu<mailto:etd-help@listserv.cc.emory.edu> with your request. \n\n" \
"Please do not reply directy to this email.\n\n" \

Expand Down
14 changes: 6 additions & 8 deletions app/services/hyrax/workflow/unhidden_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ def workflow_recipients
{ "to" => (approvers << depositor) }
end

private

def subject
'Deposit has been unhidden'
end
def subject
'Deposit has been unhidden'
end

def message
"#{title} (#{link_to work_id, document_path}) was unhidden by #{user.display_name} #{comment}"
end
def message
"#{title} (#{link_to work_id, document_url}) was unhidden by #{user.display_name} #{comment}"
end
end
end
end
16 changes: 7 additions & 9 deletions app/services/hyrax/workflow/virus_encountered_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ def workflow_recipients
{ "to" => (approvers << depositor) }
end

private

def subject
"Virus encountered in #{title}"
end
def subject
"Virus encountered in #{title}"
end

def message
"A virus has been detected in the work #{title} (#{link_to work_id, document_path}). " \
"The infected file has been deleted and a clean version will need to be resubmitted."
end
def message
"A virus has been detected in the work #{title} (#{link_to work_id, document_url}). " \
"The infected file has been deleted and a clean version will need to be resubmitted."
end
end
end
end
4 changes: 3 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Laevigata
class Application < Rails::Application
config.action_mailer.default_url_options = { host: ENV["HYRAX_HOST"] }
config.action_mailer.raise_delivery_errors = false
# The compile method (default in tinymce-rails 4.5.2) doesn't work when also
# using tinymce-rails-imageupload, so revert to the :copy method
# https://github.com/spohlenz/tinymce-rails/issues/183
Expand All @@ -23,3 +24,4 @@ class Application < Rails::Application
# -- all .rb files in that directory are automatically loaded.
end
end
Rails.application.routes.default_url_options[:host] = ENV["HYRAX_HOST"]
4 changes: 2 additions & 2 deletions config/initializers/mailboxer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
config.uses_emails = true

# Configures the default from for emails sent for Messages and Notifications
config.default_from = "no-reply@mailboxer.com"
config.default_from = "Emory ETD Service <etd@aws.emory.edu>"

# Configures the methods needed by mailboxer
config.email_method = :mailboxer_email
config.name_method = :name
config.name_method = :display_name

# Configures if you use or not a search engine and which one you are using
# Supported engines: [:solr,:sphinx]
Expand Down
Loading

0 comments on commit 58841f9

Please sign in to comment.