]> git.lizzy.rs Git - cheatdb.git/commitdiff
Fix misattribution of review due to missing reply ordering
authorrubenwardy <rw@rubenwardy.com>
Sun, 12 Jul 2020 22:53:20 +0000 (23:53 +0100)
committerrubenwardy <rw@rubenwardy.com>
Sun, 12 Jul 2020 22:53:20 +0000 (23:53 +0100)
app/models.py
app/templates/macros/reviews.html

index 3e71c750a1ab36cd7d21e7dbb057022264e9e12b..ade4083594f07c939a65e42c0d75da2c9c7c4b92 100644 (file)
@@ -1101,10 +1101,11 @@ class Thread(db.Model):
 
        created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
 
-       replies    = db.relationship("ThreadReply", backref="thread", lazy="dynamic")
+       replies    = db.relationship("ThreadReply", backref="thread", lazy="dynamic", \
+                       order_by=db.asc("thread_reply_id"))
 
        watchers   = db.relationship("User", secondary=watchers, lazy="subquery", \
-                                               backref=db.backref("watching", lazy=True))
+                       backref=db.backref("watching", lazy=True))
 
        def getViewURL(self):
                return url_for("threads.view", id=self.id)
index 42ae614f089799c4f619828c902c7ad05398a341..6ba176cc0af17752954341d6960f74806ee1f4b2 100644 (file)
                                <div class="col pr-0">
                                        <div class="card">
                                                <div class="card-header">
-                                                       <a class="author {{ reply.author.rank.name }}"
-                                                                       href="{{ url_for('users.profile', username=reply.author.username) }}">
-                                                               {{ reply.author.display_name }}
+                                                       <a class="author {{ review.author.rank.name }}"
+                                                                       href="{{ url_for('users.profile', username=review.author.username) }}">
+                                                               {{ review.author.display_name }}
                                                        </a>
 
                                                        <a name="reply-{{ reply.id }}" class="text-muted float-right"
                                                                        href="{{ url_for('threads.view', id=review.thread.id) }}#reply-{{ reply.id }}">
-                                                               {{ reply.created_at | datetime }}
+                                                               {{ review.created_at | datetime }}
                                                        </a>
                                                </div>