Add AuthenticationToken to UserMailer.exercise_anomaly_needs_feedback

This commit is contained in:
Sebastian Serth
2024-04-18 16:03:24 +02:00
committed by Sebastian Serth
parent e1d87b51e9
commit 0a379721a1
3 changed files with 3 additions and 9 deletions

View File

@ -47,8 +47,6 @@ de:
<br> <br>
%{exercise} - %{link} %{exercise} - %{link}
<br> <br>
Falls Sie beim Klick auf diesen Link eine Fehlermeldung erhalten, dass Sie nicht berechtigt wären diese Aktion auszuführen, öffnen Sie bitte eine beliebige Programmieraufgabe aus einem Kurs heraus und klicken den Link danach noch einmal.<br>
<br>
Diese Mail wurde automatisch von CodeOcean verschickt.<br> Diese Mail wurde automatisch von CodeOcean verschickt.<br>
<br> <br>
_________________________<br> _________________________<br>
@ -59,8 +57,6 @@ de:
<br> <br>
%{exercise} - %{link} %{exercise} - %{link}
<br> <br>
If you receive an error that you are not authorized to perform this action when clicking the link, please log-in through any course exercise beforehand and click the link again. <br>
<br>
This mail was automatically sent by CodeOcean. <br> This mail was automatically sent by CodeOcean. <br>
subject: Eine Aufgabe auf CodeOcean benötigt Ihr Feedback subject: Eine Aufgabe auf CodeOcean benötigt Ihr Feedback
got_new_comment: got_new_comment:

View File

@ -47,8 +47,6 @@ en:
<br> <br>
%{exercise} - %{link} %{exercise} - %{link}
<br> <br>
Falls Sie beim Klick auf diesen Link eine Fehlermeldung erhalten, dass Sie nicht berechtigt wären diese Aktion auszuführen, öffnen Sie bitte eine beliebige Programmieraufgabe aus einem Kurs heraus und klicken den Link danach noch einmal.<br>
<br>
Diese Mail wurde automatisch von CodeOcean verschickt.<br> Diese Mail wurde automatisch von CodeOcean verschickt.<br>
<br> <br>
_________________________<br> _________________________<br>
@ -59,8 +57,6 @@ en:
<br> <br>
%{exercise} - %{link} %{exercise} - %{link}
<br> <br>
If you receive an error that you are not authorized to perform this action when clicking the link, please log-in through any course exercise beforehand and click the link again. <br>
<br>
This mail was automatically sent by CodeOcean. <br> This mail was automatically sent by CodeOcean. <br>
subject: An exercise on CodeOcean needs your feedback subject: An exercise on CodeOcean needs your feedback
got_new_comment: got_new_comment:

View File

@ -153,8 +153,10 @@ namespace :detect_exercise_anomalies do
users = contributor.try(:users) || [contributor] users = contributor.try(:users) || [contributor]
users.each do |user| users.each do |user|
host = CodeOcean::Application.config.action_mailer.default_url_options[:host] host = CodeOcean::Application.config.action_mailer.default_url_options[:host]
last_submission = user.submissions.where(exercise:).latest
token = AuthenticationToken.generate!(user, last_submission.study_group).shared_secret
feedback_link = Rails.application.routes.url_helpers.url_for(action: :new, feedback_link = Rails.application.routes.url_helpers.url_for(action: :new,
controller: :user_exercise_feedbacks, exercise_id: exercise.id, host:) controller: :user_exercise_feedbacks, exercise_id: exercise.id, host:, token:)
UserMailer.exercise_anomaly_needs_feedback(user, exercise, feedback_link).deliver UserMailer.exercise_anomaly_needs_feedback(user, exercise, feedback_link).deliver
end end
end end