Skip to content

Commit

Permalink
🧹 Clean up model overrides
Browse files Browse the repository at this point in the history
Most of what's in this commit is just updating the Hyrax version in the
override comments.  There was also an opportunity to switch the
`ContactForm` model to a decorator.
  • Loading branch information
kirkkwang committed Dec 20, 2023
1 parent bee1f4f commit 05d2838
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 50 deletions.
2 changes: 1 addition & 1 deletion app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Ability
self.ability_logic += %i[everyone_can_create_curation_concerns]
end

# OVERRIDE METHOD from blacklight-access_controls v0.6.2
# OVERRIDE METHOD from blacklight-access_controls v6.0.1
#
# NOTE: DO NOT RENAME THIS METHOD - it is required for permissions to function properly.
#
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/hyrax/ability/collection_ability.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v3.4.2 Alter abilities for Groups with Roles feature
# OVERRIDE Hyrax v5.0.0rc2 Alter abilities for Groups with Roles feature
module Hyrax
module Ability
# rubocop:disable Metrics/ModuleLength
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/hyrax/ability/solr_document_ability.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v3.4.2 Alter abilities for Groups with Roles feature
# OVERRIDE Hyrax v5.0.0rc2 Alter abilities for Groups with Roles feature
module Hyrax
module Ability
module SolrDocumentAbility
Expand Down
5 changes: 3 additions & 2 deletions app/models/content_block.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v3.4.0 to add home_text to registry
# and getter/setter methods - Adding themes
# OVERRIDE Hyrax v5.0.0rc to add home_text to registry and getter/setter methods - Adding themes
# NOTE: This class inherits from ApplicationRecord while Hyrax's version inherits from ActiveRecord::Base
# so we cannot use the decorator pattern to override the methods.
# rubocop:disable Metrics/ClassLength
class ContentBlock < ApplicationRecord
# The keys in this registry are "public" names for collaborator
Expand Down
2 changes: 1 addition & 1 deletion app/models/hydra/access_controls/embargo_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE Hydra-access-controls 12.0.1
# OVERRIDE Hydra-access-controls v12.1.0
# Fix releasing embargos on the day they are expired - this solves a 1 second bug around how
# midnights are calculated, which causes day of embargos to incorrectly set the permissions to private
module Hydra
Expand Down
2 changes: 1 addition & 1 deletion app/models/hydra/access_controls/lease_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE Hydra-access-controls 12.0.1
# OVERRIDE Hydra-access-controls 12.1.0
# Fix releasing leases on the day they are expired - this solves a 1 second bug around how
# midnights are calculated, which causes day of leases to incorrectly set the permissions to private
module Hydra
Expand Down
2 changes: 1 addition & 1 deletion app/models/hyrax/collection_type_participant_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v3.4.2 Expand functionality for Groups with Roles feature
# OVERRIDE Hyrax v5.0.0rc2 Expand functionality for Groups with Roles feature
module Hyrax
module CollectionTypeParticipantDecorator
# OVERRIDE: #titleize agent_id for groups since we are displaying their humanized names in the dropdown
Expand Down
40 changes: 0 additions & 40 deletions app/models/hyrax/contact_form.rb

This file was deleted.

25 changes: 25 additions & 0 deletions app/models/hyrax/contact_form_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v5.0.0rc2 to override the mail to
module Hyrax
module ContactFormDecorator
# Declare the e-mail headers. It accepts anything the mail method
# in ActionMailer accepts.
###### OVERRIDE the to: field to add the Tenant's email, first
def contact_email
Site.account.contact_email_to
end

def headers
## OVERRIDE Hyrax 3.4.0 send the mail 'from' the submitter, which doesn't work on most smtp transports
{
subject: "#{Site.account.email_subject_prefix} #{email} #{subject}",
to: contact_email,
from: Site.account.contact_email,
reply_to: email
}
end
end
end

Hyrax::ContactForm.prepend(Hyrax::ContactFormDecorator)
2 changes: 1 addition & 1 deletion app/models/hyrax/group.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v3.4.2 Expand functionality for Groups with Roles Feature
# OVERRIDE Hyrax v5.0.0rc2 Expand functionality for Groups with Roles Feature
# @see https://github.com/samvera/hyku/wiki/Groups-with-Roles-Feature
module Hyrax
class Group < ApplicationRecord
Expand Down
2 changes: 1 addition & 1 deletion app/models/hyrax/permission_template_access_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v3.4.2 #titleize agent_id for groups since we are displaying their humanized names in the dropdown
# OVERRIDE Hyrax v5.0.0rc2 #titleize agent_id for groups since we are displaying their humanized names in the dropdown
module Hyrax
module PermissionTemplateAccessDecorator
def label
Expand Down

0 comments on commit 05d2838

Please sign in to comment.