From 013055187ab28a483acde00f8390e49a44d8b9e2 Mon Sep 17 00:00:00 2001 From: Hunternif Date: Sun, 16 Feb 2025 19:15:04 +0000 Subject: client: hide safety buttons if user doesn't have privilege --- client/html/posts_header.tpl | 6 ++++-- client/js/controllers/post_list_controller.js | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/html/posts_header.tpl b/client/html/posts_header.tpl index 7d5fa78..1e30eb4 100644 --- a/client/html/posts_header.tpl +++ b/client/html/posts_header.tpl @@ -6,10 +6,12 @@ %><% - %><% if (ctx.enableSafety) { %><% + %><% if (ctx.enableSafety && (ctx.canListSketchy || ctx.canListUnsafe)) { %><% %>'/><% %>'/><% - %>'/><% + if (ctx.canListUnsafe) { + %>'/><% + } %><% } %><% %><% if (ctx.isLoggedIn) { %><% %><% diff --git a/client/js/controllers/post_list_controller.js b/client/js/controllers/post_list_controller.js index 0146e9e..9e5d6d5 100644 --- a/client/js/controllers/post_list_controller.js +++ b/client/js/controllers/post_list_controller.js @@ -44,6 +44,8 @@ class PostListController { parameters: ctx.parameters, isLoggedIn: api.isLoggedIn(), enableSafety: api.safetyEnabled(), + canListSketchy: api.hasPrivilege("posts:list:sketchy"), + canListUnsafe: api.hasPrivilege("posts:list:unsafe"), canBulkEditTags: api.hasPrivilege("posts:bulk-edit:tags"), canBulkEditSafety: api.hasPrivilege("posts:bulk-edit:safety"), canViewMetrics: api.hasPrivilege("metrics:list"), -- cgit v1.3