|
a/Allura/allura/model/discuss.py |
|
b/Allura/allura/model/discuss.py |
|
... |
|
... |
7 |
|
7 |
|
8 |
from ming import schema
|
8 |
from ming import schema
|
9 |
from ming.orm.base import session
|
9 |
from ming.orm.base import session
|
10 |
from ming.orm.property import (FieldProperty, RelationProperty,
|
10 |
from ming.orm.property import (FieldProperty, RelationProperty,
|
11 |
ForeignIdProperty)
|
11 |
ForeignIdProperty)
|
|
|
12 |
from ming.utils import LazyProperty
|
12 |
|
13 |
|
13 |
from allura.lib import helpers as h
|
14 |
from allura.lib import helpers as h
|
14 |
from allura.lib import security
|
15 |
from allura.lib import security
|
15 |
from allura.lib.security import require_access, has_access
|
16 |
from allura.lib.security import require_access, has_access
|
16 |
from allura.model.notification import Notification, Mailbox
|
17 |
from allura.model.notification import Notification, Mailbox
|
|
... |
|
... |
67 |
self.num_topics = self.thread_class().query.find(
|
68 |
self.num_topics = self.thread_class().query.find(
|
68 |
dict(discussion_id=self._id)).count()
|
69 |
dict(discussion_id=self._id)).count()
|
69 |
self.num_posts = self.post_class().query.find(
|
70 |
self.num_posts = self.post_class().query.find(
|
70 |
dict(discussion_id=self._id, status='ok')).count()
|
71 |
dict(discussion_id=self._id, status='ok')).count()
|
71 |
|
72 |
|
72 |
@property
|
73 |
@LazyProperty
|
73 |
def last_post(self):
|
74 |
def last_post(self):
|
74 |
q = self.post_class().query.find(dict(
|
75 |
q = self.post_class().query.find(dict(
|
75 |
discussion_id=self._id)).sort('timestamp', pymongo.DESCENDING)
|
76 |
discussion_id=self._id)).sort('timestamp', pymongo.DESCENDING)
|
76 |
return q.first()
|
77 |
return q.first()
|
77 |
|
78 |
|