This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new 2faf9aa62 [#4359] Correct performance regression on discussion threads
2faf9aa62 is described below

commit 2faf9aa623f4d1786102ad05cb5414e95286e21a
Author: Kenton Taylor <[email protected]>
AuthorDate: Tue Apr 5 14:55:07 2022 +0000

    [#4359] Correct performance regression on discussion threads
---
 Allura/allura/lib/widgets/discuss.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Allura/allura/lib/widgets/discuss.py 
b/Allura/allura/lib/widgets/discuss.py
index 101f83afe..60e1222a4 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -350,9 +350,10 @@ class Thread(HierWidget):
         context = super().prepare_context(context)
         # bulk fetch backrefs to save on many queries within EW
         thread: M.Thread = context['value']
-        index_ids = [a.index_id() for a in thread.discussion.posts]
+        posts = thread.posts
+        index_ids = [a.index_id() for a in posts]
         q = M.ArtifactReference.query.find(dict(references={'$in': 
index_ids})).all()
-        for a in thread.discussion.posts:
+        for a in posts:
             a._backrefs = [aref._id for aref in q if a.index_id() in 
(aref.references or [])]
         return context
 

Reply via email to