• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

curationexperts / laevigata / 0d10b93f-7d12-4108-bfd7-303659b33b6c

18 Jun 2025 03:38AM UTC coverage: 97.41% (-0.001%) from 97.411%
0d10b93f-7d12-4108-bfd7-303659b33b6c

Pull #2464

circleci

mark-dce
Disable embargo expiration notifications

Per discussions with SCO, they wish to reduce administrative overhead
by eliminating embargo expiration notifications.

We still need to process actual embargo expirations to change the
corresponding ETDs from a restricted to open status.

Therefore, this change leaves the schedule and service code in place
and simply comments out the calls to notification processing so that
we still get nightly expiration processing.
Pull Request #2464: Disable embargo expiration notifications

4 of 4 new or added lines in 1 file covered. (100.0%)

43 existing lines in 7 files now uncovered.

2821 of 2896 relevant lines covered (97.41%)

52.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.68
/app/presenters/etd_presenter.rb
1
class EtdPresenter < Hyrax::WorkShowPresenter
4✔
2
  delegate :abstract,
4✔
3
           :abstract_embargoed,
4
           :committee_chair_name,
5
           :committee_members_names,
6
           :degree,
7
           :department,
8
           :embargo_length,
9
           :files_embargoed,
10
           :graduation_date,
11
           :language,
12
           :school,
13
           :partnering_agency,
14
           :research_field,
15
           :rights_statement,
16
           :table_of_contents,
17
           :toc_embargoed,
18
           :requires_permissions,
19
           :other_copyrights,
20
           :patents,
21
           :under_embargo?,
22
           to: :solr_document
23

24
  # we want to override the permission_badge method in the FileSetPresenter class, because we handle embargos differently than Hyrax does.
25
  # Therefore we create an EtdFileSetPresenter that overwrites the permission_badge method,
26
  # and ensure the views get it by setting it as the file_presenter_class in the EtdMemberPresenterFactory, and creating an Etd member factory here.
27

28
  def subfield
4✔
29
    return unless solr_document.subfield
33✔
30
    id = solr_document.subfield.first
3✔
31
    school = Schools::School.new(solr_document.school.first)
3✔
32
    dept = Schools::Department.new(school, solr_document.department.first)
3✔
33

34
    return unless dept.service
3✔
35
    Schools::Subfield.new(school, dept, id).label
3✔
36
  end
37

38
  def member_presenter_factory
4✔
39
    Hyrax::EtdMemberPresenterFactory.new(solr_document, current_ability, request)
106✔
40
  end
41

42
  ##
43
  # Override `PresentsAttributes` to Use the custom `EtdPermissionBadge` class,
44
  # adding view support for custom Etd visibilities (embargo levels).
45
  #
46
  # @return [Class]
47
  def permission_badge_class
4✔
48
    EtdPermissionBadge
34✔
49
  end
50

51
  # Given an ARK in the identifier field, return an Emory permanent_url
52
  def permanent_url
4✔
53
    return nil unless identifier && identifier.first && identifier.first.match(/^ark/)
33✔
54
    "http://pid.emory.edu/#{identifier.first}"
×
55
  end
56

57
  # Return the post_graduation_email
58
  # NOTE: The field is defined as multivalued, but the application only stores a single value
59
  def post_graduation_email
4✔
60
    solr_document.to_h.dig('post_graduation_email_tesim', 0)
13✔
61
  end
62

63
  # Disabling .ttl, jsonld and nt entirely, because these methods expose embargoed content.
64
  # If we need it in the future, go back to using the version of this method
65
  # defined in Hyrax.
66
  def export_as_ttl
4✔
67
    'Not implemented at this time.'
×
68
  end
69

70
  def export_as_jsonld
4✔
71
    'Not implemented at this time.'
×
72
  end
73

74
  def export_as_json
4✔
75
    'Not implemented at this time.'
×
76
  end
77

78
  def export_as_nt
4✔
79
    'Not implemented at this time.'
×
80
  end
81

82
  def formatted_embargo_release_date
4✔
83
    embargo_release_date.strftime("%d %B %Y")
35✔
84
  end
85

86
  def degree_awarded
4✔
87
    return "graduation pending" unless solr_document.degree_awarded
52✔
88
    solr_document.degree_awarded.to_date.strftime("%d %B %Y")
13✔
89
  end
90

91
  def proquest_submission_date
4✔
92
    return unless solr_document.proquest_submission_date
13✔
UNCOV
93
    solr_document.proquest_submission_date.first.to_date.strftime("%d %B %Y")
1✔
94
  end
95

96
  def submitting_type
4✔
97
    return "ETD" unless solr_document.submitting_type
127✔
98
    solr_document.submitting_type.first
77✔
99
  end
100

101
  # School-dependent label for departments
102
  # @return 'Department' unless school==nursing, which uses 'Specialty' instead
103
  def department_or_specialty
4✔
104
    school&.first&.match?(/Nursing|Woodruff/i) ? 'Specialty' : 'Department'
35✔
105
  end
106

107
  def current_user_roles
4✔
108
    # Note: AdminSets need an exact, non-tokenized solr query. A query like
109
    # AdminSet.where(title: admin_set) is too broad and might match the wrong AdminSet,
110
    # because there are AdminSets with similar names (e.g., Epidemiology and Global Epidemiology)
111
    workflow = AdminSet.where(title_sim: admin_set.first).first.active_workflow
54✔
112
    Hyrax::Workflow::PermissionQuery.scope_processing_workflow_roles_for_user_and_workflow(
54✔
113
      user: current_ability.current_user,
114
      workflow: workflow
115
    ).pluck(:role_id).map { |r| Sipity::Role.where(id: r).first.name }
150✔
116
  end
117

118
  def current_ability_is_approver?
4✔
119
    return false if current_ability.current_user.id.nil?
114✔
120
    roles = current_user_roles
54✔
121
    return true if roles.include? "approving"
54✔
122
    return true if roles.include? "reviewing"
12✔
123
    false
12✔
124
  end
125

126
  def current_ability_is_depositor?
4✔
127
    return false unless solr_document["depositor_ssim"] && solr_document["depositor_ssim"].first
79✔
128
    return true if current_ability.current_user.ppid == solr_document["depositor_ssim"].first
72✔
129
    false
56✔
130
  end
131

132
  # TODO: check date of embargo release and make sure it hasn't passed already
133
  def abstract_with_embargo_check
4✔
134
    return "No abstract is available." unless abstract && abstract.first
38✔
135
    return abstract_for_admin if current_ability.admin?
34✔
136
    return abstract_for_admin if current_ability_is_depositor?
26✔
137
    return abstract_for_admin if current_ability_is_approver?
20✔
138
    return "This abstract is under embargo until #{formatted_embargo_release_date}" if under_embargo? && abstract_embargoed
15✔
139
    abstract.first
11✔
140
  end
141

142
  def abstract_for_admin
4✔
143
    admin_return_message = ""
19✔
144
    if under_embargo? && abstract_embargoed
19✔
145
      admin_return_message +=
8✔
146
        if solr_document.degree_awarded
8✔
147
          "[Abstract embargoed until #{formatted_embargo_release_date}] "
2✔
148
        elsif embargo_length
6✔
149
          "[Abstract embargoed until #{embargo_length} post-graduation] "
5✔
150
        else
151
          "[Abstract embargoed until post-graduation] "
1✔
152
        end
153
    end
154

155
    if under_embargo? && abstract_embargoed && degree_awarded
19✔
156
    elsif under_embargo? && abstract_embargoed
11✔
157
    end
158
    admin_return_message + abstract.first
19✔
159
  end
160

161
  def toc_with_embargo_check
4✔
162
    return "No table of contents is available." unless table_of_contents && table_of_contents.first
36✔
163
    return toc_for_admin if current_ability.admin?
32✔
164
    return toc_for_admin if current_ability_is_depositor?
25✔
165
    return toc_for_admin if current_ability_is_approver?
19✔
166
    return "This table of contents is under embargo until #{formatted_embargo_release_date}" if under_embargo? && toc_embargoed
14✔
167
    table_of_contents.first
11✔
168
  end
169

170
  def files_embargo_check
4✔
171
    return nil unless under_embargo? && files_embargoed
91✔
UNCOV
172
    return nil if current_ability.admin?
33✔
UNCOV
173
    return nil if current_ability_is_depositor?
28✔
UNCOV
174
    return nil if current_ability_is_approver?
24✔
UNCOV
175
    "File download under embargo until #{formatted_embargo_release_date}"
12✔
176
  end
177

178
  def toc_for_admin
4✔
179
    admin_return_message = ""
22✔
180
    if under_embargo? && toc_embargoed
22✔
181
      admin_return_message +=
11✔
182
        if embargo_length && solr_document.degree_awarded.blank?
11✔
183
          "[Table of contents embargoed until #{embargo_length} post-graduation] "
5✔
184
        elsif embargo_release_date
6✔
185
          "[Table of contents embargoed until #{formatted_embargo_release_date}] "
6✔
186
        else
187
          "[Table of contents embargoed until post-graduation] "
×
188
        end
189
    end
190
    admin_return_message + table_of_contents.first
22✔
191
  end
192
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc