diff --git a/app/controllers/feedback_requests_controller.rb b/app/controllers/feedback_requests_controller.rb index 3102f9942d..21ad271218 100644 --- a/app/controllers/feedback_requests_controller.rb +++ b/app/controllers/feedback_requests_controller.rb @@ -31,7 +31,7 @@ def create def request_feedback_flash_notice # Use the generic feedback confirmation message unless the Org has # specified one - text = current_user.org.feedback_email_msg || feedback_confirmation_default_message + text = current_user.org.feedback_msg || feedback_confirmation_default_message feedback_constant_to_text(text, current_user, @plan, current_user.org) end diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index cad171d993..f302afd450 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -215,7 +215,7 @@ def org_params .permit(:name, :abbreviation, :logo, :contact_email, :contact_name, :remove_logo, :managed, :feedback_enabled, :org_links, :funder, :institution, :organisation, - :feedback_email_msg, :org_id, :org_name, :org_crosswalk, + :feedback_msg, :org_id, :org_name, :org_crosswalk, identifiers_attributes: %i[identifier_scheme_id value], tracker_attributes: %i[code id]) end diff --git a/app/controllers/super_admin/orgs_controller.rb b/app/controllers/super_admin/orgs_controller.rb index 6cecf152a2..6e2c49634b 100644 --- a/app/controllers/super_admin/orgs_controller.rb +++ b/app/controllers/super_admin/orgs_controller.rb @@ -149,9 +149,7 @@ def merge_commit def org_params params.require(:org).permit(:name, :abbreviation, :logo, :managed, :contact_email, :contact_name, - :remove_logo, :feedback_enabled, - :feedback_email_subject, - :feedback_email_msg, + :remove_logo, :feedback_enabled, :feedback_msg, :org_id, :org_name, :org_crosswalk) end diff --git a/app/controllers/template_options_controller.rb b/app/controllers/template_options_controller.rb index 8118cc8b22..373e48c074 100644 --- a/app/controllers/template_options_controller.rb +++ b/app/controllers/template_options_controller.rb @@ -79,7 +79,7 @@ def plan_params end def org_params - %i[id name sort_name url language abbreviation ror fundref weight score] + %i[id name url language abbreviation ror fundref weight score] end end diff --git a/app/javascript/src/orgs/adminEdit.js b/app/javascript/src/orgs/adminEdit.js index ac27b03499..c393c39c27 100644 --- a/app/javascript/src/orgs/adminEdit.js +++ b/app/javascript/src/orgs/adminEdit.js @@ -7,7 +7,7 @@ import { initAutocomplete, scrubOrgSelectionParamsOnSubmit } from '../utils/auto $(() => { const toggleFeedback = () => { - const editor = Tinymce.findEditorById('org_feedback_email_msg'); + const editor = Tinymce.findEditorById('org_feedback_msg'); if (isObject(editor)) { if ($('#org_feedback_enabled_true').is(':checked')) { editor.setMode('code'); @@ -22,7 +22,7 @@ $(() => { }); // Initialises tinymce for any target element with class tinymce_answer - Tinymce.init({ selector: '#org_feedback_email_msg' }); + Tinymce.init({ selector: '#org_feedback_msg' }); toggleFeedback(); if ($('#org-details-org-controls').length > 0) { diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index f5dd48f29b..86a52ad1dc 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -138,23 +138,6 @@ def feedback_complete(recipient, plan, requestor) end end - def feedback_confirmation(recipient, plan, requestor) - return unless user.org.present? && recipient.active? - - user = requestor - org = user.org - plan = plan - # Use the generic feedback confirmation message unless the Org has specified one - subject = org.feedback_email_subject || feedback_confirmation_default_subject - message = org.feedback_email_msg || feedback_confirmation_default_message - @body = feedback_constant_to_text(message, user, plan, org) - - I18n.with_locale I18n.default_locale do - mail(to: recipient.email, - subject: feedback_constant_to_text(subject, user, plan, org)) - end - end - def plan_visibility(user, plan) return unless user.active? diff --git a/app/models/answer.rb b/app/models/answer.rb index dd03175142..c994391b04 100644 --- a/app/models/answer.rb +++ b/app/models/answer.rb @@ -9,7 +9,6 @@ # text :text # created_at :datetime # updated_at :datetime -# label_id :string # plan_id :integer # question_id :integer # user_id :integer diff --git a/app/models/org.rb b/app/models/org.rb index 6aa1537bde..de2526de38 100644 --- a/app/models/org.rb +++ b/app/models/org.rb @@ -8,10 +8,9 @@ # abbreviation :string # contact_email :string # contact_name :string -# feedback_email_msg :text -# feedback_email_subject :string +# feedback_msg :text # feedback_enabled :boolean default(FALSE) -# is_other :boolean default(FALSE), not null +# is_other :boolean default(FALSE), not null # links :text # logo_name :string # logo_uid :string @@ -42,14 +41,10 @@ class Org < ApplicationRecord LOGO_FORMATS = %w[jpeg png gif jpg bmp].freeze HUMANIZED_ATTRIBUTES = { - feedback_email_msg: _("Feedback email message") + feedback_msg: _("Feedback email message") }.freeze - # TODO: we don't allow this to be edited on the frontend, can we remove from DB? - # if not, we'll need to add a rake:task to ensure that each of these is set for each - # org - attribute :feedback_email_subject, :string, default: feedback_confirmation_default_subject - attribute :feedback_email_msg, :text, default: feedback_confirmation_default_message + attribute :feedback_msg, :text, default: feedback_confirmation_default_message attribute :language_id, :integer, default: -> { Language.default&.id } attribute :links, :text, default: { "org": [] } @@ -101,7 +96,7 @@ class Org < ApplicationRecord validates :abbreviation, presence: { message: PRESENCE_MESSAGE } validates :is_other, inclusion: { in: BOOLEAN_VALUES, - message: INCLUSION_MESSAGE } + message: PRESENCE_MESSAGE } validates :language, presence: { message: PRESENCE_MESSAGE } @@ -117,11 +112,8 @@ class Org < ApplicationRecord validates :feedback_enabled, inclusion: { in: BOOLEAN_VALUES, message: INCLUSION_MESSAGE } - validates :feedback_email_subject, presence: { message: PRESENCE_MESSAGE, - if: :feedback_enabled } - - validates :feedback_email_msg, presence: { message: PRESENCE_MESSAGE, - if: :feedback_enabled } + validates :feedback_msg, presence: { message: PRESENCE_MESSAGE, + if: :feedback_enabled } validates :managed, inclusion: { in: BOOLEAN_VALUES, message: INCLUSION_MESSAGE } @@ -372,10 +364,7 @@ def merge_attributes!(to_be_merged:) self.contact_email = to_be_merged.contact_email unless contact_email.present? self.contact_name = to_be_merged.contact_name unless contact_name.present? self.feedback_enabled = to_be_merged.feedback_enabled unless feedback_enabled? - self.feedback_email_msg = to_be_merged.feedback_email_msg unless feedback_email_msg.present? - # rubocop:disable Layout/LineLength - self.feedback_email_subject = to_be_merged.feedback_email_subject unless feedback_email_subject.present? - # rubocop:enable Layout/LineLength + self.feedback_msg = to_be_merged.feedback_msg unless feedback_msg.present? end # rubocop:enable Metrics/AbcSize diff --git a/app/models/org_identifier.rb b/app/models/org_identifier.rb deleted file mode 100644 index 287a717c01..0000000000 --- a/app/models/org_identifier.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: org_identifiers -# -# id :integer not null, primary key -# attrs :string -# identifier :string -# created_at :datetime -# updated_at :datetime -# identifier_scheme_id :integer -# org_id :integer -# -# Indexes -# -# fk_rails_189ad2e573 (identifier_scheme_id) -# fk_rails_36323c0674 (org_id) -# -# Foreign Keys -# -# fk_rails_... (identifier_scheme_id => identifier_schemes.id) -# fk_rails_... (org_id => orgs.id) -# - -class OrgIdentifier < ApplicationRecord - - # ================ - # = Associations = - # ================ - - belongs_to :org - belongs_to :identifier_scheme - - # =============== - # = Validations = - # =============== - - # Should only be able to have one identifier per scheme! - validates :identifier_scheme_id, uniqueness: { scope: :org_id, - message: UNIQUENESS_MESSAGE } - - validates :identifier, presence: { message: PRESENCE_MESSAGE } - - validates :org, presence: { message: PRESENCE_MESSAGE } - - validates :identifier_scheme, presence: { message: PRESENCE_MESSAGE } - - # ========================= - # = Custom Accessor Logic = - # ========================= - - # ensure attrs is a hash before saving - # TODO: evaluate this approach vs Serialize from condition.rb - def attrs=(hash) - super(hash.is_a?(Hash) ? hash.to_json.to_s : "{}") - end - -end diff --git a/app/models/user.rb b/app/models/user.rb index 5391699faa..f5995c996e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -23,9 +23,7 @@ # invited_by_type :string # last_sign_in_at :datetime # last_sign_in_ip :string -# ldap_password :string -# ldap_username :string -# other_organisation :string +# other_organisation :string # recovery_email :string # remember_created_at :datetime # reset_password_sent_at :datetime diff --git a/app/models/user_identifier.rb b/app/models/user_identifier.rb deleted file mode 100644 index 0ce3d7ea8d..0000000000 --- a/app/models/user_identifier.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -# == Schema Information -# -# Table name: user_identifiers -# -# id :integer not null, primary key -# identifier :string -# created_at :datetime -# updated_at :datetime -# identifier_scheme_id :integer -# user_id :integer -# -# Indexes -# -# fk_rails_fe95df7db0 (identifier_scheme_id) -# index_user_identifiers_on_user_id (user_id) -# -# Foreign Keys -# -# fk_rails_... (identifier_scheme_id => identifier_schemes.id) -# fk_rails_... (user_id => users.id) -# - -class UserIdentifier < ApplicationRecord - - # ================ - # = Associations = - # ================ - - belongs_to :user - belongs_to :identifier_scheme - - # =============== - # = Validations = - # =============== - - validates :user, presence: true - - validates :identifier_scheme, presence: { message: PRESENCE_MESSAGE } - - validates :identifier, presence: { message: PRESENCE_MESSAGE } - -end diff --git a/app/policies/identifier_policy.rb b/app/policies/identifier_policy.rb index 03fac6bec1..d9afca3286 100644 --- a/app/policies/identifier_policy.rb +++ b/app/policies/identifier_policy.rb @@ -2,8 +2,6 @@ class IdentifierPolicy < ApplicationPolicy - attr_reader :user_identifier - def initialize(user, users) raise Pundit::NotAuthorizedError, "must be logged in" unless user diff --git a/app/presenters/org_selection_presenter.rb b/app/presenters/org_selection_presenter.rb index 5f725213d8..b31f2e2b31 100644 --- a/app/presenters/org_selection_presenter.rb +++ b/app/presenters/org_selection_presenter.rb @@ -7,7 +7,6 @@ class OrgSelectionPresenter def initialize(orgs:, selection:) @crosswalk = [] - # TODO: Remove this once the is_other Org has been removed @name = selection.present? ? selection.name : "" orgs = [selection] if !orgs.present? || orgs.empty? @@ -19,7 +18,6 @@ def initialize(orgs:, selection:) end end - # Return the Org name unless this is the default is_other Org attr_reader :name def crosswalk diff --git a/app/presenters/super_admin/orgs/merge_presenter.rb b/app/presenters/super_admin/orgs/merge_presenter.rb index e3bc57cf96..0e503408e7 100644 --- a/app/presenters/super_admin/orgs/merge_presenter.rb +++ b/app/presenters/super_admin/orgs/merge_presenter.rb @@ -108,8 +108,7 @@ def org_attributes(org:) { contact_email: org.contact_email, contact_name: org.contact_name, - feedback_email_msg: org.feedback_email_msg, - feedback_email_subject: org.feedback_email_subject, + feedback_msg: org.feedback_msg, feedback_enabled: org.feedback_enabled, managed: org.managed, links: org.links, @@ -135,8 +134,7 @@ def mergeable_columns end if mergeable_column?(column: :feedback_enabled) out[:feedback_enabled] = @from_org.feedback_enabled - out[:feedback_email_subject] = @from_org.feedback_email_subject - out[:feedback_email_msg] = @from_org.feedback_email_msg + out[:feedback_msg] = @from_org.feedback_msg end out end diff --git a/app/services/org_selection/hash_to_org_service.rb b/app/services/org_selection/hash_to_org_service.rb index 29883e7649..ef722429a1 100644 --- a/app/services/org_selection/hash_to_org_service.rb +++ b/app/services/org_selection/hash_to_org_service.rb @@ -14,7 +14,7 @@ module OrgSelection # } # becomes: # An Org with name = "Foo (foo.org)", - # org_identifier (ROR) = "http://example.org/123" + # identifier (ROR) = "http://example.org/123" # class HashToOrgService diff --git a/app/services/org_selection/org_to_hash_service.rb b/app/services/org_selection/org_to_hash_service.rb index 79ccd4dcb2..0f37ee18c9 100644 --- a/app/services/org_selection/org_to_hash_service.rb +++ b/app/services/org_selection/org_to_hash_service.rb @@ -12,7 +12,7 @@ class << self # Convert an Identifiable Model over to hash results like: # An Org with id = 123, name = "Foo (foo.org)", - # org_identifier (ROR) = "http://example.org/123" + # identifier (ROR) = "http://example.org/123" # becomes: # { # id: "123", diff --git a/app/views/orgs/_feedback_form.html.erb b/app/views/orgs/_feedback_form.html.erb index f0bba98eec..6378091be1 100644 --- a/app/views/orgs/_feedback_form.html.erb +++ b/app/views/orgs/_feedback_form.html.erb @@ -23,8 +23,8 @@
<%= _("Click below to give data management staff at #{plan.owner.org.name}, the Plan Owner's org, access to read and comment on your plan.") %>
<%= _('You can continue to edit and download the plan in the interim.') %>