|
a/Allura/allura/model/artifact.py |
|
b/Allura/allura/model/artifact.py |
|
... |
|
... |
571 |
author_link = FieldProperty(str, if_missing=lambda:c.user.url() if hasattr(c, 'user') else None)
|
571 |
author_link = FieldProperty(str, if_missing=lambda:c.user.url() if hasattr(c, 'user') else None)
|
572 |
artifact_reference = FieldProperty(S.Deprecated)
|
572 |
artifact_reference = FieldProperty(S.Deprecated)
|
573 |
|
573 |
|
574 |
|
574 |
|
575 |
@classmethod
|
575 |
@classmethod
|
576 |
def post(cls, artifact, title=None, description=None):
|
576 |
def post(cls, artifact, title=None, description=None, author=None):
|
577 |
"Create a Feed item"
|
577 |
"Create a Feed item"
|
578 |
# TODO: fix security system so we can do this correctly and fast
|
578 |
# TODO: fix security system so we can do this correctly and fast
|
579 |
from allura import model as M
|
579 |
from allura import model as M
|
580 |
anon = M.User.anonymous()
|
580 |
anon = M.User.anonymous()
|
581 |
if not security.has_access(artifact, 'read', user=anon):
|
581 |
if not security.has_access(artifact, 'read', user=anon):
|
|
... |
|
... |
584 |
return
|
584 |
return
|
585 |
idx = artifact.index()
|
585 |
idx = artifact.index()
|
586 |
if title is None:
|
586 |
if title is None:
|
587 |
title='%s modified by %s' % (idx['title_s'], c.user.get_pref('display_name'))
|
587 |
title='%s modified by %s' % (idx['title_s'], c.user.get_pref('display_name'))
|
588 |
if description is None: description = title
|
588 |
if description is None: description = title
|
|
|
589 |
if author is None: author = c.user
|
589 |
item = cls(
|
590 |
item = cls(
|
590 |
ref_id=artifact.index_id(),
|
591 |
ref_id=artifact.index_id(),
|
591 |
neighborhood_id=artifact.app_config.project.neighborhood_id,
|
592 |
neighborhood_id=artifact.app_config.project.neighborhood_id,
|
592 |
project_id=artifact.app_config.project_id,
|
593 |
project_id=artifact.app_config.project_id,
|
593 |
app_config_id=artifact.app_config_id,
|
594 |
app_config_id=artifact.app_config_id,
|
594 |
tool_name=artifact.app_config.tool_name,
|
595 |
tool_name=artifact.app_config.tool_name,
|
595 |
title=title,
|
596 |
title=title,
|
596 |
description=description,
|
597 |
description=description,
|
597 |
link=artifact.url())
|
598 |
link=artifact.url(),
|
|
|
599 |
author_name=author.get_pref('display_name'),
|
|
|
600 |
author_link=author.url())
|
598 |
return item
|
601 |
return item
|
599 |
|
602 |
|
600 |
@classmethod
|
603 |
@classmethod
|
601 |
def feed(cls, q, feed_type, title, link, description,
|
604 |
def feed(cls, q, feed_type, title, link, description,
|
602 |
since=None, until=None, offset=None, limit=None):
|
605 |
since=None, until=None, offset=None, limit=None):
|