Browse Source

Fix join clause that didn't fetch posts from a deleted user

Fixes #224.
sh4nks 8 years ago
parent
commit
3004f1a760
2 changed files with 2 additions and 2 deletions
  1. 1 1
      flaskbb/forum/views.py
  2. 1 1
      flaskbb/templates/forum/topic.html

+ 1 - 1
flaskbb/forum/views.py

@@ -116,7 +116,7 @@ def view_topic(topic_id, slug=None):
 
     # fetch the posts in the topic
     posts = Post.query.\
-        join(User, Post.user_id == User.id).\
+        outerjoin(User, Post.user_id == User.id).\
         filter(Post.topic_id == topic.id).\
         add_entity(User).\
         order_by(Post.id.asc()).\

+ 1 - 1
flaskbb/templates/forum/topic.html

@@ -54,7 +54,7 @@
 
                     {% else %}
                     <!-- user deleted or guest -->
-                    <div class="author-name"><h4><a href="{{ user.url }}">{{ post.username }}</a></h4></div>
+                    <div class="author-name"><h4>{{ post.username }}</h4></div>
                     <div class="author-title"><h5>{% trans %}Guest{% endtrans %}</h5></div>
                     {% endif %}