Skip to content

Commit 7b6dfd1

Browse files
authored
Merge pull request #2004 from codidact/art/online-safety-updates
2 parents 5eb67ed + e3f190e commit 7b6dfd1

21 files changed

Lines changed: 899 additions & 7 deletions

.github/workflows/ci-cd.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ jobs:
4848
uses: actions/setup-node@v1
4949
with:
5050
node-version: 22
51-
- run: npm install
52-
- run: tsc
51+
- run: npm ci --verbose
52+
- run: npx tsc --version
53+
- run: npm run typecheck
5354

5455
tests:
5556
name: Ruby on Rails tests

app/assets/stylesheets/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ $danger: #EB5959;
1818
$success: #2ECC71;
1919
$info: #58A09A;
2020
$brand: #4B68FF;
21+
$brand-comp: #F05137;
2122

2223

2324
$data: (

app/assets/stylesheets/complaints.scss

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,44 @@
6060
.is-lead + h1.complaint-title {
6161
margin-top: -1rem;
6262
}
63+
64+
.is-brand-comp {
65+
color: $brand-comp;
66+
}
67+
68+
.with-subtitle {
69+
margin-bottom: 0;
70+
}
71+
72+
.subtitle {
73+
margin-top: 0;
74+
font-weight: normal;
75+
font-size: 1.2rem;
76+
}
77+
78+
.modules {
79+
display: grid;
80+
grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
81+
gap: 0.5rem;
82+
}
83+
84+
.module-widget {
85+
border: 1px solid $muted-graphic;
86+
border-radius: 0.2rem;
87+
padding: 0.5rem;
88+
color: $key !important;
89+
90+
> h4 {
91+
text-decoration: underline;
92+
}
93+
94+
> p {
95+
text-decoration: none;
96+
}
97+
98+
&:hover {
99+
background: $primary;
100+
color: white !important;
101+
text-decoration: none !important;
102+
}
103+
}

app/controllers/complaints_controller.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class ComplaintsController < ApplicationController
33
before_action :access_check, only: [:show, :comment]
44
before_action :write_access_check, only: [:self_assign, :update_status, :change_content_type]
55
before_action :verify_staff, only: [:reports, :reporting]
6+
before_action :training_access, only: [:training, :training_complete]
67

78
def index
89
render layout: 'without_sidebar'
@@ -202,6 +203,28 @@ def reporting
202203
render layout: 'without_sidebar'
203204
end
204205

206+
def training
207+
pages = Dir.glob(Rails.root.join('app', 'views', 'complaints', 'training', '*.html.erb'))
208+
.map { |page| File.basename(page, '.html.erb') }
209+
if pages.include?(params[:page])
210+
render "complaints/training/#{params[:page]}", layout: 'osa_training'
211+
else
212+
not_found!
213+
end
214+
end
215+
216+
def training_complete
217+
user_update = current_user.update(osa_training: DateTime.now)
218+
audit_log = AuditLog.moderator_audit(event_type: 'osa_training_completed', user: current_user,
219+
comment: 'OSA training completed.')
220+
if user_update && audit_log
221+
flash[:success] = I18n.t('safety_center.training_complete')
222+
else
223+
flash[:danger] = I18n.t('safety_center.training_complete_failed')
224+
end
225+
redirect_to safety_center_path
226+
end
227+
205228
private
206229

207230
def access_check
@@ -235,4 +258,11 @@ def set_complaint
235258

236259
@complaint
237260
end
261+
262+
def training_access
263+
osa_training_enabled = SiteSetting['OSATrainingEnabled']
264+
unless user_signed_in? && (current_user.staff? || current_user.at_least_moderator?) && osa_training_enabled
265+
not_found!
266+
end
267+
end
238268
end

app/views/complaints/index.html.erb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@
2525
</div>
2626
</div>
2727
</div>
28+
<% if SiteSetting['OSATrainingEnabled'] %>
29+
<div class="grid--cell is-12 is-6-lg">
30+
<div class="widget">
31+
<div class="widget--body">
32+
<h2 class="has-font-size-larger h-m-t-0">
33+
<%= link_to osa_training_path('home') do %>
34+
Moderator training &raquo;
35+
<% end %>
36+
</h2>
37+
<p class="has-font-size-caption">
38+
Complete your training for volunteer moderation staff.
39+
</p>
40+
</div>
41+
</div>
42+
</div>
43+
<% end %>
2844
</div>
2945

3046
<% if user_signed_in? && current_user.staff? %>

app/views/complaints/report.html.erb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
<p>
77
Thank you for taking the time to make a report. If you've seen harmful, abusive, or illegal content on our
88
communities, you can report this to us here. You can also use this page if you've received a message saying we've
9-
classified your content as harmful, abusive, or illegal and you wish to contest it.
9+
classified your content as harmful, abusive, or illegal and you wish to contest it, or if you have a complaint
10+
about our processes or our compliance with our duties.
1011
</p>
1112

1213
<div class="notice is-warning has-color-yellow-900 flex-row-always ai-c has-font-size-caption h-m-b-4">
@@ -45,7 +46,8 @@
4546
<%= label_tag :reported_url, 'Where is this content?' %>
4647
<div class="form-caption">
4748
Enter a URL or link to where we can find this content on our network. You can use the Copy Link button under
48-
posts to get a direct link to a post.
49+
posts to get a direct link to a post. Enter N/A if you are not complaining about specific content; add more
50+
details below.
4951
</div>
5052
<%= text_field_tag :reported_url, nil, class: 'form-element', required: true %>
5153
</div>
@@ -95,6 +97,11 @@
9597
Tell us any additional information you have about this report. Is there any additional content we removed that
9698
you would like to include? Provide detailed reasoning explaining why you disagree with our classification.
9799
</div>
100+
<div class="form-caption hidden" data-report-type="process">
101+
Tell us the details of your complaint. Do you believe we have failed to comply with our statutory duties, or
102+
that we have failed to follow our policies and procedures? In what way? Provide any relevant examples or
103+
evidence.
104+
</div>
98105
<%= text_area_tag :content, nil, class: 'form-element', required: true, rows: 10 %>
99106
</div>
100107

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<p class="has-font-size-caption has-color-tertiary-600">Last updated 22 March 2026</p>
2+
3+
<h1 class="is-brand-comp with-subtitle">Online Safety Act</h1>
4+
<h2 class="subtitle">Conclusion</h2>
5+
6+
<p>
7+
Thank you for taking the time to go through this training. We appreciate that these are often difficult and sensitive
8+
topics, but your understanding and assistance help us to create safe communities for all our users. As community
9+
moderators you're likely to see problems before we do, and we appreciate your help in bringing them to our attention.
10+
</p>
11+
<p>
12+
Please click the button below to mark your training complete. You can come back to these pages at any time from the
13+
Safety Center if you need a reminder. If you need any support, please contact the Community Team.
14+
</p>
15+
16+
<%= form_tag osa_training_complete_path, method: :post do %>
17+
<%= submit_tag 'Mark as complete', class: 'button is-filled is-primary' %>
18+
<% end %>

0 commit comments

Comments
 (0)