Browse Source

Hide "View Markdown" when user can edit the post

If a user can edit a post, they don't need the ability to view the
markdown separately, so the button doesn't need to be shown in those
cases. I'm not sure if this should be a separate permission defined
inside the ACL or not.
merge-requests/101/merge
Deimos 5 years ago
parent
commit
c3c3a073d2
  1. 3
      tildes/tildes/templates/macros/comments.jinja2
  2. 6
      tildes/tildes/templates/topic.jinja2

3
tildes/tildes/templates/macros/comments.jinja2

@ -202,6 +202,8 @@
</li>
{% endif %}
{# Don't show the "View Markdown" button (or dropdown) if the user can edit #}
{% if not request.has_permission("edit", comment) %}
<li>
<div class="dropdown dropdown-right">
<button class="btn-post-action dropdown-toggle">
@ -222,6 +224,7 @@
</menu>
</div>
</li>
{% endif %}
</menu>
<div class="btn-post-settings"></div>
{% endif %}

6
tildes/tildes/templates/topic.jinja2

@ -173,7 +173,11 @@
{{ post_action_toggle_button("remove", topic, topic.is_removed) }}
{% endif %}
{% if topic.is_text_type and request.has_permission("view_content", topic) %}
{# Only show "View Markdown" (and dropdown) when it's a text topic and the user is
allowed to view the content, but can't edit it #}
{% if topic.is_text_type
and request.has_permission("view_content", topic)
and not request.has_permission("edit", topic) %}
<li>
<div class="dropdown dropdown-right">
<button class="btn-post-action dropdown-toggle">

Loading…
Cancel
Save