Browse Source

Hide user info (reg. date, bio) if deleted/banned

merge-requests/64/head
Deimos 6 years ago
parent
commit
c9833dd065
  1. 8
      tildes/tildes/models/user/user.py
  2. 2
      tildes/tildes/templates/user.jinja2

8
tildes/tildes/models/user/user.py

@ -177,6 +177,14 @@ class User(DatabaseModel):
# - only allow logged-in users to look through user history # - only allow logged-in users to look through user history
acl.append((Allow, Authenticated, "view_history")) acl.append((Allow, Authenticated, "view_history"))
# view_info:
# - can't view info (registration date, bio, etc.) for deleted/banned users
# - otherwise, everyone can view
if self.is_banned or self.is_deleted:
acl.append((Deny, Everyone, "view_info"))
acl.append((Allow, Everyone, "view_info"))
# message: # message:
# - deleted and banned users can't be messaged # - deleted and banned users can't be messaged
# - otherwise, logged-in users can message anyone except themselves # - otherwise, logged-in users can message anyone except themselves

2
tildes/tildes/templates/user.jinja2

@ -116,6 +116,7 @@
<hr> <hr>
{% endif %} {% endif %}
{% if request.has_permission("view_info", user) %}
<h2>User info</h2> <h2>User info</h2>
<dl> <dl>
<dt>Registered</dt> <dt>Registered</dt>
@ -128,6 +129,7 @@
</div> </div>
{% endif %} {% endif %}
</dl> </dl>
{% endif %}
{% if request.has_permission('message', user) %} {% if request.has_permission('message', user) %}
<a href="/user/{{ user.username }}/new_message" class="btn btn-primary">Send a private message</a> <a href="/user/{{ user.username }}/new_message" class="btn btn-primary">Send a private message</a>

Loading…
Cancel
Save