Switch to unified view

a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
...
...
71
            dict(discussion_id=self._id, status='ok')).count()
71
            dict(discussion_id=self._id, status='ok')).count()
72
72
73
    @LazyProperty
73
    @LazyProperty
74
    def last_post(self):
74
    def last_post(self):
75
        q = self.post_class().query.find(dict(
75
        q = self.post_class().query.find(dict(
76
                discussion_id=self._id))\
76
                discussion_id=self._id)).sort('timestamp', pymongo.DESCENDING)
77
            .sort('timestamp', pymongo.DESCENDING)\
78
            .limit(1)\
79
            .hint([('discussion_id', pymongo.ASCENDING)])
80
            # hint is to try to force the index to be used, since mongo wouldn't select it sometimes
81
            # https://groups.google.com/forum/#!topic/mongodb-user/0TEqPfXxQU8
77
        return q.first()
82
        return q.first()
78
83
79
    def url(self):
84
    def url(self):
80
        return self.app.url + '_discuss/'
85
        return self.app.url + '_discuss/'
81
86