admin: blur moderation for certain categories

This commit is contained in:
Kyle Drake
2026-03-25 19:23:57 -05:00
parent f75f60f5fb
commit 9a045e5c0e
5 changed files with 12 additions and 4 deletions
+2
View File
@@ -10,6 +10,8 @@ get '/admin/reports' do
@page = params[:page] ? params[:page].to_i : 1
@page = 1 if @page < 1
@per_page = 51
@moderation_blur_categories = $config['moderation_blur_categories']
@reports = Report.join(:sites, id: :site_id).where(sites__is_deleted: false, sites__is_banned: false).order(:reports__created_at.desc).select_all(:reports).paginate(@page, @per_page)
@pagination_dataset = @reports
+2 -1
View File
@@ -29,4 +29,5 @@ minfraud_license_key: DERPDERPDERP
google_custom_search_key: herpderp
google_custom_search_cx: herpderp
google_custom_search_query_limit: 69
support_email: derp@example.com
support_email: derp@example.com
moderation_blur_categories: [ cats, dogs ]
+3 -1
View File
@@ -32,6 +32,7 @@ development:
google_custom_search_cx: herpderp
google_custom_search_query_limit: 69
support_email: derp@example.com
moderation_blur_categories: [ cats, dogs ]
test:
database: 'postgres://localhost/neocities_test'
database_pool: 1
@@ -69,4 +70,5 @@ test:
google_custom_search_key: herpderp
google_custom_search_cx: herpderp
google_custom_search_query_limit: 69
support_email: derp@example.com
support_email: derp@example.com
moderation_blur_categories: [ cats, dogs ]
+1
View File
@@ -242,6 +242,7 @@ describe '/admin' do
_(page.body).must_match(/\b1 banned\b/)
_(page.body).must_match(/\b1 deleted\b/)
end
end
describe 'email blasting' do
+4 -2
View File
@@ -24,12 +24,14 @@
else
screenshot_path = 'index.html'
end
blur_sensitive_screenshot = @moderation_blur_categories.include?(report.type)
%>
<div style="position: relative; margin-bottom: 10px;">
<a href="<%= report.site.uri + '/' + screenshot_path %>" target="_blank">
<img src="<%= report.site.screenshot_url(screenshot_path, '540x405') %>"
style="width: 100%; height: auto; border: 1px solid #ddd;">
style="width: 100%; height: auto; border: 1px solid #ddd;<%= ' filter: blur(4px);' if blur_sensitive_screenshot %>">
</a>
<% if report.type && !report.type.empty? %>
<span class="alert-error" style="position: absolute; top: 5px; right: 5px; padding: 2px 6px; font-size: 11px; border-radius: 3px;">
@@ -163,4 +165,4 @@ function dismissReport(reportId) {
alert('Error: ' + error);
});
}
</script>
</script>