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
5
5
6
6
def report_content
7
7
@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' )
8
15
9
16
mail ( subject : I18n . t ( 'report_mailer.report_content.subject' , content_name : @reported_content . model_name . human ) )
10
17
end
Original file line number Diff line number Diff line change @@ -2,3 +2,5 @@ h3 = t('.prolog')
2
2
blockquote style =" white-space: pre-wrap;" = @reported_content.question
3
3
p = t('.take_action')
4
4
p = 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 5
5
== t('.take_action')
6
6
== "\n\n"
7
7
== 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 2
2
de :
3
3
report_mailer :
4
4
report_content :
5
+ authentication : Kurs-URL für die LTI-Authentifizierung.
5
6
prolog : ' Die folgenden Inhalte wurden als unangemessen gemeldet:'
6
7
subject : ' Spam Report: Ein %{content_name} in CodeOcean wurde als unangemessen markiert.'
7
8
take_action : Bitte ergreifen Sie gegebenenfalls Maßnahmen.
Original file line number Diff line number Diff line change 2
2
en :
3
3
report_mailer :
4
4
report_content :
5
+ authentication : Course URL for LTI authentication.
5
6
prolog : ' The following content has been reported as inappropriate:'
6
7
subject : ' Spam Report: A %{content_name} on CodeOcean has been marked as inappropriate.'
7
8
take_action : Please take action if required.
Original file line number Diff line number Diff line change 22
22
expect ( mail . text_part . body ) . to include ( question )
23
23
expect ( mail . html_part . body ) . to include ( question )
24
24
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
25
34
end
26
35
end
27
36
end
You can’t perform that action at this time.
0 commit comments