File tree Expand file tree Collapse file tree 6 files changed +25
-0
lines changed
Expand file tree Collapse file tree 6 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ class ReportMailer < ApplicationMailer
55
66 def report_content
77 @reported_content = params . fetch ( :reported_content )
8+ study_group = @reported_content . submission . study_group
9+ exercise = @reported_content . exercise
10+
11+ # NOTE: This implementation assumes the course URL is static and does not vary per user.
12+ # This is currently valid for a majority of use cases. However, in dynamic scenarios (such as
13+ # content trees in openHPI used in conjunction with A/B/n testing) this assumption may no longer hold true.
14+ @course_url = LtiParameter . find_by ( study_group :, exercise :) &.lti_parameters &.[]( 'launch_presentation_return_url' )
815
916 mail ( subject : I18n . t ( 'report_mailer.report_content.subject' , content_name : @reported_content . model_name . human ) )
1017 end
Original file line number Diff line number Diff line change @@ -2,3 +2,5 @@ h3 = t('.prolog')
22blockquote style =" white-space: pre-wrap;" = @reported_content .question
33p = t(' .take_action' )
44p = link_to(request_for_comment_url(@reported_content ), request_for_comment_url(@reported_content ))
5+ - if @course_url .present?
6+ p = link_to(t(' .authentication' ), @course_url )
Original file line number Diff line number Diff line change 55== t(' .take_action' )
66== " \n\n "
77== request_for_comment_url(@reported_content )
8+ == " \n\n "
9+ - if @course_url .present?
10+ == t(' .authentication' )
11+ == " \n\n "
12+ == @course_url
Original file line number Diff line number Diff line change 22de :
33 report_mailer :
44 report_content :
5+ authentication : Kurs-URL für die LTI-Authentifizierung.
56 prolog : ' Die folgenden Inhalte wurden als unangemessen gemeldet:'
67 subject : ' Spam Report: Ein %{content_name} in CodeOcean wurde als unangemessen markiert.'
78 take_action : Bitte ergreifen Sie gegebenenfalls Maßnahmen.
Original file line number Diff line number Diff line change 22en :
33 report_mailer :
44 report_content :
5+ authentication : Course URL for LTI authentication.
56 prolog : ' The following content has been reported as inappropriate:'
67 subject : ' Spam Report: A %{content_name} on CodeOcean has been marked as inappropriate.'
78 take_action : Please take action if required.
Original file line number Diff line number Diff line change 2222 expect ( mail . text_part . body ) . to include ( question )
2323 expect ( mail . html_part . body ) . to include ( question )
2424 end
25+
26+ it 'includes the LTI retrun URL for course authentication' do
27+ create ( :lti_parameter ,
28+ exercise : reported_content . exercise ,
29+ study_group : reported_content . submission . study_group )
30+
31+ expect ( mail . text_part . body ) . to match ( %r{https.+/courses/} )
32+ expect ( mail . html_part . body ) . to match ( %r{https.+/courses/} )
33+ end
2534 end
2635 end
2736end
You can’t perform that action at this time.
0 commit comments