|
a/Allura/allura/model/discuss.py |
|
b/Allura/allura/model/discuss.py |
|
... |
|
... |
170 |
if not self.first_post:
|
170 |
if not self.first_post:
|
171 |
self.first_post_id = p._id
|
171 |
self.first_post_id = p._id
|
172 |
Feed.post(self, title=p.subject, description=p.text)
|
172 |
Feed.post(self, title=p.subject, description=p.text)
|
173 |
return p
|
173 |
return p
|
174 |
|
174 |
|
175 |
def post(self, text, message_id=None, parent_id=None, timestamp=None, **kw):
|
175 |
def post(self, text, message_id=None, parent_id=None,
|
|
|
176 |
timestamp=None, ignore_security=False, **kw):
|
|
|
177 |
if not ignore_security:
|
176 |
require_access(self, 'post')
|
178 |
require_access(self, 'post')
|
177 |
if self.ref_id and self.artifact:
|
179 |
if self.ref_id and self.artifact:
|
178 |
self.artifact.subscribe()
|
180 |
self.artifact.subscribe()
|
179 |
if message_id is None: message_id = h.gen_message_id()
|
181 |
if message_id is None: message_id = h.gen_message_id()
|
180 |
parent = parent_id and self.post_class().query.get(_id=parent_id)
|
182 |
parent = parent_id and self.post_class().query.get(_id=parent_id)
|
181 |
slug, full_slug = self.post_class().make_slugs(parent, timestamp)
|
183 |
slug, full_slug = self.post_class().make_slugs(parent, timestamp)
|
|
... |
|
... |
188 |
text=text,
|
190 |
text=text,
|
189 |
status='pending')
|
191 |
status='pending')
|
190 |
if timestamp is not None: kwargs['timestamp'] = timestamp
|
192 |
if timestamp is not None: kwargs['timestamp'] = timestamp
|
191 |
if message_id is not None: kwargs['_id'] = message_id
|
193 |
if message_id is not None: kwargs['_id'] = message_id
|
192 |
post = self.post_class()(**kwargs)
|
194 |
post = self.post_class()(**kwargs)
|
193 |
if has_access(self, 'unmoderated_post')():
|
195 |
if ignore_security or has_access(self, 'unmoderated_post')():
|
194 |
log.info('Auto-approving message from %s', c.user.username)
|
196 |
log.info('Auto-approving message from %s', c.user.username)
|
195 |
post.approve()
|
197 |
post.approve()
|
196 |
else:
|
198 |
else:
|
197 |
self.notify_moderators(post)
|
199 |
self.notify_moderators(post)
|
198 |
return post
|
200 |
return post
|