You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/12/13 06:07:58 UTC
[12/45] git commit: [#6941] Create activity events for commits
[#6941] Create activity events for commits
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/785bb177
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/785bb177
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/785bb177
Branch: refs/heads/tv/6942
Commit: 785bb177d0366e52d5acb1d6341e46fd93a18739
Parents: 2374176
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Dec 4 00:59:20 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Dec 6 21:24:26 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/repo.py | 13 ++++++++++++-
Allura/allura/model/repo_refresh.py | 2 ++
2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/785bb177/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 3b4feca..1ff6641 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -41,6 +41,7 @@ from allura.lib import helpers as h
from .auth import User
from .session import main_doc_session, project_doc_session
from .session import repository_orm_session
+from .timeline import ActivityObject
log = logging.getLogger(__name__)
@@ -164,11 +165,21 @@ class RepoObject(object):
r = cls.query.get(_id=id)
return r, isnew
-class Commit(RepoObject):
+class Commit(RepoObject, ActivityObject):
type_s = 'Commit'
# Ephemeral attrs
repo=None
+ @property
+ def activity_name(self):
+ return self.shorthand_id()
+
+ def has_activity_access(self, perm, user):
+ """Commits have no ACLs and are therefore always viewable by any user.
+
+ """
+ return True
+
def set_context(self, repo):
self.repo = repo
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/785bb177/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 52855b5..2a8af51 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -137,6 +137,8 @@ def refresh_repo(repo, all_commits=False, notify=True, new_clone=False):
user = User.by_username(new.committed.name)
if user is not None:
g.statsUpdater.newCommit(new, repo.app_config.project, user)
+ g.director.create_activity(user, 'committed', new,
+ related_nodes=[repo.app_config.project])
log.info('Refresh complete for %s', repo.full_fs_path)
g.post_event('repo_refreshed', len(commit_ids), all_commits, new_clone)