diff options
| author | Hunternif <hunternif@gmail.com> | 2021-09-03 17:21:31 +0100 |
|---|---|---|
| committer | Hunternif <hunternif@gmail.com> | 2021-09-03 17:21:31 +0100 |
| commit | 63326a502e078176804a720afaa4746999f006ac (patch) | |
| tree | c65f6d68e2c59f2be5619c475439d8bb7f76622d | |
| parent | 857220eb8800057f81c5bb55f044f1334dc55f9a (diff) | |
client: show similar posts section only with permission
| -rw-r--r-- | client/html/post_readonly_sidebar.tpl | 12 | ||||
| -rw-r--r-- | client/js/controls/post_readonly_sidebar_control.js | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/client/html/post_readonly_sidebar.tpl b/client/html/post_readonly_sidebar.tpl index 045cce8..6c6cbbe 100644 --- a/client/html/post_readonly_sidebar.tpl +++ b/client/html/post_readonly_sidebar.tpl @@ -82,11 +82,13 @@ </nav> <% } %> - <nav class='similar'> - <h1>Similar</h1> - <ul></ul> - <a href='<%- ctx.formatClientLink("posts", {query: "similar:" + ctx.post.id}) %>'>See more</a> - </nav> + <% if (ctx.canViewSimilar) { %> + <nav class='similar'> + <h1>Similar</h1> + <ul></ul> + <a href='<%- ctx.formatClientLink("posts", {query: "similar:" + ctx.post.id}) %>'>See more</a> + </nav> + <% } %> <nav class='tags'> <h1>Tags (<%- ctx.post.tags.length %>)</h1> diff --git a/client/js/controls/post_readonly_sidebar_control.js b/client/js/controls/post_readonly_sidebar_control.js index e1c4afc..d8b7388 100644 --- a/client/js/controls/post_readonly_sidebar_control.js +++ b/client/js/controls/post_readonly_sidebar_control.js @@ -33,6 +33,7 @@ class PostReadonlySidebarControl extends events.EventTarget { canListPosts: api.hasPrivilege("posts:list"), canEditPosts: api.hasPrivilege("posts:edit"), canViewTags: api.hasPrivilege("tags:view"), + canViewSimilar: api.hasPrivilege("posts:view:similar"), escapeTagName: uri.escapeTagName, extractRootDomain: uri.extractRootDomain, getPrettyName: misc.getPrettyName, |