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

pulibrary / orangelight / 4c391e0e-519a-40cb-8ad3-354445f4ce03

12 Aug 2025 08:47PM UTC coverage: 85.348% (-10.0%) from 95.335%
4c391e0e-519a-40cb-8ad3-354445f4ce03

push

circleci

web-flow
[#5143] Use access restriction note as Aeon ItemInfo1 if available (#5173)

With this commit, if a user visits a record with an access
restrictions note and presses the Reading Room Request
button, they will get to an Aeon form with the 'Restrictions'
field pre-filled with the restriction note.

If the record does not have an access restrictions note,
the field will be pre-filled with 'Reading Room Access Only',
as it has been previously.

Closes #5143

5493 of 6436 relevant lines covered (85.35%)

251.82 hits per line

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

89.36
/app/controllers/feedback_controller.rb
1
# frozen_string_literal: true
2

3
class FeedbackController < ApplicationController
1✔
4
  include ApplicationHelper
1✔
5

6
  before_action :current_user_email
1✔
7
  before_action :build_feedback_form, only: [:create]
1✔
8
  before_action :build_ask_a_question_form, only: [:ask_a_question]
1✔
9
  before_action :build_suggest_correction_form, only: [:suggest_correction]
1✔
10
  before_action :build_report_biased_results_form, only: [:report_biased_results]
1✔
11

12
  def new
1✔
13
    @feedback_form = FeedbackForm.new if @feedback_form.nil?
1✔
14
    @feedback_form.current_url = request.referer || root_url
1✔
15
  end
16

17
  def create
1✔
18
    respond_to do |format|
1✔
19
      if @feedback_form.valid?
1✔
20
        @feedback_form.deliver
1✔
21
        format.js { flash.now[:notice] = I18n.t('blacklight.feedback.success') }
2✔
22
      else
23
        format.js { flash.now[:error] = @feedback_form.error_message }
×
24
      end
25
    end
26
  end
27

28
  def ask_a_question; end
1✔
29

30
  def suggest_correction; end
1✔
31

32
  def report_biased_results; end
1✔
33

34
  protected
1✔
35

36
    def build_feedback_form
1✔
37
      @feedback_form = FeedbackForm.new(feedback_form_params)
1✔
38
      @feedback_form.request = request
1✔
39
      @feedback_form
1✔
40
    end
41

42
    def feedback_form_params
1✔
43
      params.require(:feedback_form).permit(:name, :email, :message, :current_url, :feedback_desc)
1✔
44
    end
45

46
    def build_ask_a_question_form
1✔
47
      @question_form = AskAQuestionForm.new(
1✔
48
        context: page_url(question_form_params),
49
        title: question_form_params['title']
50
      )
51
    end
52

53
    def question_form_params
1✔
54
      params.require(:ask_a_question_form).permit(:id, :title)
2✔
55
    end
56

57
    def build_suggest_correction_form
1✔
58
      @suggest_correction_form = SuggestCorrectionForm.new(
2✔
59
        context: page_url(suggest_correction_form_params),
60
        title: suggest_correction_form_params['title']
61
      )
62
    end
63

64
    def suggest_correction_form_params
1✔
65
      params.require(:suggest_correction_form).permit(:id, :title)
4✔
66
    end
67

68
    def build_report_biased_results_form
1✔
69
      @biased_results_form = ReportBiasedResultsForm.new(
1✔
70
        biased_results_params
71
      )
72
    end
73

74
    def biased_results_params
1✔
75
      params.require(:report_biased_results_form).permit(:context)
1✔
76
    end
77

78
    def search_results_url(_params)
1✔
79
      search_catalog_url(q: biased_results_params['q'])
×
80
    end
81

82
    def page_url(params)
1✔
83
      solr_document_url(id: params['id'])
3✔
84
    end
85

86
    def current_user_email
1✔
87
      return if current_user.nil?
6✔
88
      return if current_user.provider != 'cas'
×
89
      @user_email = "#{current_user.uid}@princeton.edu"
×
90
      @user_email
×
91
    end
92
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