#1560 ForgeDiscussion doesn't favor Sticky flag

v1.0.0
closed
sf-4 (350)
Forum
nobody
2015-08-20
2011-02-24
No

With [#1549], it's now possible to set sticky flag for a thread, but threads are not sorted by it actually. That's because:

class ForumController(DiscussionController):
    @expose('jinja:discussion/index.html')
    def index(self, threads=None, limit=None, page=0, count=0, **kw):
        if self.discussion.deleted and not has_artifact_access('configure', app=c.app)():
            redirect(self.discussion.url()+'deleted')
        limit, page, start = g.handle_paging(limit, page)
        threads = DM.ForumThread.query.find(dict(discussion_id=self.discussion._id)).sort('mod_date', pymongo.DESCENDING)
        return super(ForumController, self).index(threads=threads.skip(start).limit(int(limit)).all(), limit=limit, page=page, count=threads.count(), **kw)

I.e., the list is sorted just on mod_date (which brings own problems, sent mail to the allura list), nothing else.

What should be said that there's Forum.threads property, which returns threads in the order according to flags, but in its turn, doesn't order by date. Also, its efficiency leaves much to be desired (it unions thread groups in python space).

So, something full-functional and efficient should be devised instead.

Related

Tickets: #1549
Tickets: #1565

Discussion

  • Paul Sokolovsky

    Paul Sokolovsky - 2011-03-16

    To verify: Create a thread, then set a Sticky flag on it via moderation pull-down dialog (pencil icon in title bar). Create few more threads. Ensure that Sticky one still stays on the top.

    ps/1560

     
  • Paul Sokolovsky

    Paul Sokolovsky - 2011-03-16
    • status: in-progress --> validation
    • assigned_to: Paul Sokolovsky --> Jenny Steele
    • size: 4 --> 4
     
  • Paul Sokolovsky

    Paul Sokolovsky - 2011-03-17
    • status: validation --> code-review
     
  • Jenny Steele

    Jenny Steele - 2011-03-22
    • status: code-review --> closed
     

Log in to post a comment.