incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/3] git commit: [#6941] Create activity events for commits
Date Fri, 06 Dec 2013 21:24:38 GMT
[#6941] Create activity events for commits

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@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/master
Commit: 785bb177d0366e52d5acb1d6341e46fd93a18739
Parents: 2374176
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Wed Dec 4 00:59:20 2013 +0000
Committer: Dave Brondsema <dbrondsema@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)


Mime
View raw message