Clean up more sql queries

This commit is contained in:
cuom1999 2024-04-26 20:37:35 -05:00
parent 571596dcbf
commit bf5514032b
16 changed files with 356 additions and 358 deletions

View file

@ -24,7 +24,7 @@
</div>
<div class="detail">
<div class="header">
{{ link_user(node.author, show_image=True) }}&nbsp;&nbsp;
{{ link_user(node.author_id, show_image=True) }}&nbsp;&nbsp;
{{ relative_time(node.time, abs=_('{time}'), rel=_('{time}')) }}
<span class="comment-spacer"></span>
<span class="comment-operation">
@ -48,7 +48,7 @@
<i class="fa fa-link fa-fw"></i>
</a>
{% if profile and not comment_lock %}
{% set can_edit = node.author.id == profile.id and not profile.mute %}
{% set can_edit = node.author_id == profile.id and not profile.mute %}
{% if can_edit %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}" href="#" title="{{ _('Edit') }}" class="edit-link">
<i class="fa fa-pencil fa-fw"></i>

View file

@ -5,11 +5,11 @@
{{ comment.page_title }}
</a>
</h3>
{% with author=comment.author %}
{% if author %}
{% with author_id=comment.author_id %}
{% if author_id %}
<div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i>
<span class="pi-value">{{ link_user(author) }}</span>
<span class="pi-value">{{ link_user(author_id) }}</span>
</div>
{% endif %}
{% endwith %}

View file

@ -9,7 +9,7 @@
<div class="left-sidebar">
{% if can_access %}
{{ make_tab_item('detail', 'fa fa-info-circle', url('contest_view', contest.key), _('Info')) }}
{% if contest.ended or can_edit %}
{% if (contest.ended and not contest.is_in_contest(request.user)) or can_edit %}
{{ make_tab_item('stats', 'fa fa-pie-chart', url('contest_stats', contest.key), _('Statistics')) }}
{% endif %}
{% endif %}

View file

@ -1,4 +1,4 @@
{% set can_view = submission.is_accessible_by(profile) %}
{% set can_view = submission.is_accessible_by(profile, check_contest=False) or is_in_editable_contest %}
<div class="sub-user-img user-img">
<img loading="lazy" src="{{gravatar(submission.user)}}">
</div>

View file

@ -8,20 +8,21 @@
{{ ticket.title }}
</a>
</h3>
{% with author=ticket.user %}
{% if author %}
{% with author_id = ticket.user_id %}
{% if author_id %}
<div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i>
<span class="pi-value">{{ link_user(author) }}</span>
<span class="pi-value">{{ link_user(author_id) }}</span>
</div>
{% endif %}
{% endwith %}
{% set last_message = ticket.messages.last() %}
<div class="problem-feed-types">
<i class="fa fa-tag"></i>
{{link_user(ticket.messages.last().user)}} {{_(' replied')}}
{{link_user(last_message.user_id)}} {{_('replied')}}
</div>
<div class='blog-description content-description'>
{{ ticket.messages.last().body|markdown(lazy_load=True)|reference|str|safe }}
{{ last_message.body|markdown(lazy_load=True)|reference|str|safe }}
<div class="show-more"> {{_("...More")}} </div>
</div>
</div>