allura
修订版 | 7603c33217322d324c0a5b3519f56229af69959e (tree) |
---|---|
时间 | 2011-02-24 03:58:47 |
作者 | Jenny Steele <jsteele@geek...> |
Commiter | Jenny Steele |
[#1529] Recent posts and post reply count now take moderation into account
Signed-off-by: Jenny Steele <jsteele@geek.net>
@@ -428,10 +428,13 @@ class ModerationController(BaseController): | ||
428 | 428 | posted = self.PostModel.query.get(slug=p['slug']) |
429 | 429 | if delete: |
430 | 430 | posted.delete() |
431 | + posted.thread.num_replies -= 1 | |
431 | 432 | elif spam: |
432 | 433 | posted.status = 'spam' |
434 | + posted.thread.num_replies -= 1 | |
433 | 435 | elif approve: |
434 | 436 | posted.status = 'ok' |
437 | + posted.thread.num_replies += 1 | |
435 | 438 | redirect(request.referer) |
436 | 439 | |
437 | 440 | class PostRestController(PostController): |
@@ -171,7 +171,7 @@ class ForgeDiscussionApp(Application): | ||
171 | 171 | recent_topics = [ SitemapEntry(h.text.truncate(thread.subject, 72), thread.url(), className='nav_child', |
172 | 172 | small=thread.num_replies) |
173 | 173 | for thread in DM.ForumThread.query.find(dict(app_config_id=self.config._id)).sort('mod_date', pymongo.DESCENDING).limit(3) |
174 | - if (not thread.discussion.deleted or has_artifact_access('configure', app=c.app)()) ] | |
174 | + if ((not thread.discussion.deleted or has_artifact_access('configure', app=c.app)()) and thread.status == 'ok') ] | |
175 | 175 | if len(recent_topics): |
176 | 176 | l.append(SitemapEntry('Recent Topics')) |
177 | 177 | l += recent_topics |
@@ -116,6 +116,10 @@ class ForumThread(M.Thread): | ||
116 | 116 | posts = RelationProperty('ForumPost') |
117 | 117 | first_post = RelationProperty('ForumPost', via='first_post_id') |
118 | 118 | |
119 | + @property | |
120 | + def status(self): | |
121 | + return self.first_post.status | |
122 | + | |
119 | 123 | @classmethod |
120 | 124 | def attachment_class(cls): |
121 | 125 | return ForumAttachment |