File tree Expand file tree Collapse file tree 16 files changed +60
-128
lines changed
Expand file tree Collapse file tree 16 files changed +60
-128
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22
33class RequestForCommentsController < ApplicationController
44 include CommonBehavior
5- before_action :set_request_for_comment , only : %i[ show mark_as_solved set_thank_you_note clear_question ]
5+ before_action :set_request_for_comment , only : %i[ show mark_as_solved set_thank_you_note clear_question report ]
66 before_action :set_study_group_grouping ,
77 only : %i[ index my_comment_requests rfcs_with_my_comments rfcs_for_exercise ]
88
@@ -162,6 +162,15 @@ def create
162162 authorize!
163163 end
164164
165+ # POST /request_for_comments/1/report
166+ def report
167+ authorize!
168+
169+ ReportMailer . with ( reported_content : @request_for_comment ) . report_content . deliver_later
170+
171+ redirect_to ( request_for_comment_path ( @request_for_comment ) , notice : t ( '.report.reported' ) )
172+ end
173+
165174 private
166175
167176 # Use callbacks to share common setup or constraints between actions.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ def rfcs_with_my_comments?
4141 everyone
4242 end
4343
44+ def report?
45+ report_receiver_configured? && !author?
46+ end
47+
48+ private
49+
50+ def report_receiver_configured?
51+ CodeOcean ::Config . new ( :code_ocean ) . read . dig ( :content_moderation , :report_emails ) . present?
52+ end
53+
4454 def rfc_visibility
4555 # The consumer with the most restricted visibility determines the visibility of the RfC
4656 case [ @user . consumer . rfc_visibility , @record . author . consumer . rfc_visibility ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ .text-end
2+ = button_to t(' .report' ), report_request_for_comment_path(request_for_comment),
3+ data: {confirm: t(' .confirm' )},
4+ class : ' btn btn-light btn-sm'
Original file line number Diff line number Diff line change 2828 .text
2929 - question = @request_for_comment .question
3030 = question.presence || t(' request_for_comments.no_question' )
31- . text-end
32- = render(' reports/button ' , reported_content : @request_for_comment )
31+ - if policy( @request_for_comment ).report?
32+ = render(' report ' , request_for_comment : @request_for_comment )
3333
3434 - if policy(@request_for_comment ).mark_as_solved? && ! @request_for_comment .solved?
3535 = render(' mark_as_solved' )
Original file line number Diff line number Diff line change 55 prolog : ' Die folgenden Inhalte wurden als unangemessen gemeldet:'
66 subject : ' Spam Report: Ein %{content_name} in CodeOcean wurde als unangemessen markiert.'
77 take_action : Bitte ergreifen Sie gegebenenfalls Maßnahmen.
8- reports :
9- confirm : Möchten Sie diesen Inhalt melden?
10- report : Melden
11- reported : Vielen Dank, dass Sie uns auf dieses Problem aufmerksam gemacht haben. Wir werden uns in Kürze darum kümmern.
Original file line number Diff line number Diff line change 4242 no_output : Keine Ausgabe.
4343 no_question : Der/die Autor:in hat keine Frage zu dieser Anfrage gestellt.
4444 passed : Erfolgreich
45+ report :
46+ confirm : Möchten Sie diesen Inhalt melden?
47+ report : Melden
48+ reported : Vielen Dank, dass Sie uns auf dieses Problem aufmerksam gemacht haben. Wir werden uns in Kürze darum kümmern.
4549 runtime_output : Programmausgabe
4650 send_thank_you_note : Senden
4751 show_all : Alle Anfragen anzeigen
Original file line number Diff line number Diff line change 55 prolog : ' The following content has been reported as inappropriate:'
66 subject : ' Spam Report: A %{content_name} on CodeOcean has been marked as inappropriate.'
77 take_action : Please take action if required.
8- reports :
9- confirm : Do you want to report this content?
10- report : Report
11- reported : Thank you for letting us know about this issue. We will look into the matter shorty.
You can’t perform that action at this time.
0 commit comments