Homepage: Preload review information in queries

This commit is contained in:
rubenwardy
2022-11-18 21:15:46 +00:00
parent b72244398b
commit db8574ffe3
8 changed files with 24 additions and 13 deletions

View File

@@ -38,7 +38,7 @@
{% endif %}
</div>
{% if review.thread %}
{% set reply = review.thread.replies[0] %}
{% set reply = review.thread.first_reply %}
<div class="col pr-0">
<div class="card">
<div class="card-header">

View File

@@ -53,7 +53,7 @@
</a>
{% endif %}
{% if current_user == thread.author and thread.review and thread.replies[0] == r %}
{% if current_user == thread.author and thread.review and thread.first_reply == r %}
<a class="float-right btn btn-primary btn-sm ml-2"
href="{{ thread.review.package.getURL('packages.review') }}">
<i class="fas fa-pen"></i>
@@ -67,7 +67,7 @@
{{ r.comment | markdown }}
{% if thread.replies[0] == r and thread.review %}
{% if thread.first_reply == r and thread.review %}
{{ render_review_vote(thread.review, current_user, thread.getViewURL()) }}
{% endif %}
</div>

View File

@@ -10,7 +10,7 @@
<h3 class="card-header">{{ self.title() }}</h3>
<div class="card-body markdown">
{{ thread.replies[0].comment | markdown }}
{{ thread.first_reply.comment | markdown }}
</div>
<div class="card-body">
<p>{{ _("Deleting is permanent") }}</p>

View File

@@ -36,7 +36,7 @@
</span>
{% endif %}
{% if r == r.thread.replies[0] %}
{% if r == r.thread.first_reply %}
<a class="badge badge-primary" href="{{ r.thread.getViewURL() }}">
{{ r.thread.title }}
</a>