Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 22
- run: npm install
- run: tsc
- run: npm ci --verbose
- run: npx tsc --version
- run: npm run typecheck

tests:
name: Ruby on Rails tests
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $danger: #EB5959;
$success: #2ECC71;
$info: #58A09A;
$brand: #4B68FF;
$brand-comp: #F05137;


$data: (
Expand Down
41 changes: 41 additions & 0 deletions app/assets/stylesheets/complaints.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,44 @@
.is-lead + h1.complaint-title {
margin-top: -1rem;
}

.is-brand-comp {
color: $brand-comp;
}

.with-subtitle {
margin-bottom: 0;
}

.subtitle {
margin-top: 0;
font-weight: normal;
font-size: 1.2rem;
}

.modules {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
gap: 0.5rem;
}

.module-widget {
border: 1px solid $muted-graphic;
border-radius: 0.2rem;
padding: 0.5rem;
color: $key !important;

> h4 {
text-decoration: underline;
}

> p {
text-decoration: none;
}

&:hover {
background: $primary;
color: white !important;
text-decoration: none !important;
}
}
30 changes: 30 additions & 0 deletions app/controllers/complaints_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class ComplaintsController < ApplicationController
before_action :access_check, only: [:show, :comment]
before_action :write_access_check, only: [:self_assign, :update_status, :change_content_type]
before_action :verify_staff, only: [:reports, :reporting]
before_action :training_access, only: [:training, :training_complete]

def index
render layout: 'without_sidebar'
Expand Down Expand Up @@ -202,6 +203,28 @@ def reporting
render layout: 'without_sidebar'
end

def training
pages = Dir.glob(Rails.root.join('app', 'views', 'complaints', 'training', '*.html.erb'))
.map { |page| File.basename(page, '.html.erb') }
if pages.include?(params[:page])
render "complaints/training/#{params[:page]}", layout: 'osa_training'
else
not_found!
end
end

def training_complete
user_update = current_user.update(osa_training: DateTime.now)
audit_log = AuditLog.moderator_audit(event_type: 'osa_training_completed', user: current_user,
comment: 'OSA training completed.')
if user_update && audit_log
flash[:success] = I18n.t('safety_center.training_complete')
else
flash[:danger] = I18n.t('safety_center.training_complete_failed')
end
redirect_to safety_center_path
end

private

def access_check
Expand Down Expand Up @@ -235,4 +258,11 @@ def set_complaint

@complaint
end

def training_access
osa_training_enabled = SiteSetting['OSATrainingEnabled']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add this check to the main safety page so we don't show a link that 404s.

unless user_signed_in? && (current_user.staff? || current_user.at_least_moderator?) && osa_training_enabled
not_found!
end
end
end
14 changes: 14 additions & 0 deletions app/views/complaints/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
</div>
</div>
</div>
<div class="grid--cell is-12 is-6-lg">
<div class="widget">
<div class="widget--body">
<h2 class="has-font-size-larger h-m-t-0">
<%= link_to osa_training_path('home') do %>
Moderator training &raquo;
<% end %>
</h2>
<p class="has-font-size-caption">
Complete your training for volunteer moderation staff.
</p>
</div>
</div>
</div>
</div>

<% if user_signed_in? && current_user.staff? %>
Expand Down
11 changes: 9 additions & 2 deletions app/views/complaints/report.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<p>
Thank you for taking the time to make a report. If you've seen harmful, abusive, or illegal content on our
communities, you can report this to us here. You can also use this page if you've received a message saying we've
classified your content as harmful, abusive, or illegal and you wish to contest it.
classified your content as harmful, abusive, or illegal and you wish to contest it, or if you have a complaint
about our processes or our compliance with our duties.
</p>

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

Expand Down
18 changes: 18 additions & 0 deletions app/views/complaints/training/conclusion.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<p class="has-font-size-caption has-color-tertiary-600">Last updated 22 March 2026</p>

<h1 class="is-brand-comp with-subtitle">Online Safety Act</h1>
<h2 class="subtitle">Conclusion</h2>

<p>
Thank you for taking the time to go through this training. We appreciate that these are often difficult and sensitive
topics, but your understanding and assistance help us to create safe communities for all our users. As community
moderators you're likely to see problems before we do, and we appreciate your help in bringing them to our attention.
</p>
<p>
Please click the button below to mark your training complete. You can come back to these pages at any time from the
Safety Center if you need a reminder. If you need any support, please contact the Community Team.
</p>

<%= form_tag osa_training_complete_path, method: :post do %>
<%= submit_tag 'Mark as complete', class: 'button is-filled is-primary' %>
<% end %>
Loading
Loading