This commit is contained in:
Julien Constant 2023-04-05 18:27:35 +02:00
parent 79a8fb0654
commit fa4ab9f54a
2 changed files with 12 additions and 10 deletions

View File

@ -39,16 +39,16 @@
<div>{{ u.user.get_display_name() }}</div> <div>{{ u.user.get_display_name() }}</div>
{% if trombi.show_profiles %} {% if trombi.show_profiles %}
<div> <div>
<a href="{{ url("trombi:user_profile", user_id=u.id) }}">{% trans %}Profile{% endtrans %}</a> <a href="{{ url('trombi:user_profile', user_id=u.id) }}">{% trans %}Profile{% endtrans %}</a>
</div> </div>
{% endif %} {% endif %}
<div> <div>
{% if can_comment %} {% if can_comment %}
{% set comment = u.received_comments.filter(author__id=user.trombi_user.id).first() %} {% set comment = u.received_comments.filter(author__id=user.trombi_user.id).first() %}
{% if comment %} {% if comment %}
<a href="{{ url("trombi:edit_comment", comment_id=comment.id) }}">{% trans %}Edit comment{% endtrans %}</a> <a href="{{ url('trombi:edit_comment', comment_id=comment.id) }}">{% trans %}Edit comment{% endtrans %}</a>
{% else %} {% else %}
<a href="{{ url("trombi:new_comment", user_id=u.id) }}">{% trans %}Comment{% endtrans %}</a> <a href="{{ url('trombi:new_comment', user_id=u.id) }}">{% trans %}Comment{% endtrans %}</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>

View File

@ -462,8 +462,10 @@ class UserTrombiProfileView(TrombiTabsMixin, DetailView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.object = self.get_object() self.object = self.get_object()
if ( if (
self.object.trombi.id != request.user.trombi_user.trombi.id request.user.is_anonymous
or self.object.trombi.id != request.user.trombi_user.trombi.id
or self.object.user.id == request.user.id or self.object.user.id == request.user.id
or not self.object.trombi.show_profiles or not self.object.trombi.show_profiles
): ):