This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch gc/8481
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/gc/8481 by this push:
new 745b19697 fixup! [#8481] added target attributes to repository activity
745b19697 is described below
commit 745b19697a7932601e8f1fe738fe1b7379140c0a
Author: Guillermo Cruz <[email protected]>
AuthorDate: Wed Nov 30 10:27:09 2022 -0600
fixup! [#8481] added target attributes to repository activity
---
Allura/allura/app.py | 14 +++++++++++++-
Allura/allura/controllers/repository.py | 2 +-
Allura/allura/model/repo_refresh.py | 2 +-
Allura/allura/tasks/repo_tasks.py | 2 +-
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 81ccd13e5..a05caded8 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -49,6 +49,7 @@ from allura import model as M
from allura.tasks import index_tasks
import six
from io import BytesIO
+from allura.model.timeline import ActivityObject
log = logging.getLogger(__name__)
@@ -218,7 +219,7 @@ class SitemapEntry:
)
-class Application:
+class Application(ActivityObject):
"""
The base Allura pluggable application
@@ -819,7 +820,18 @@ class Application:
"""
return None
+ @property
+ def activity_name(self):
+ label = f'{self.project.shortname}/{self.config.options.mount_label}'
+ return label
+
+ @property
+ def activity_url(self):
+ return self.url
+ @property
+ def activity_extras(self):
+ return {'allura_id': self.config._id}
class AdminControllerMixin:
"""Provides common functionality admin controllers need"""
diff --git a/Allura/allura/controllers/repository.py
b/Allura/allura/controllers/repository.py
index 3f9c68997..96f77d0e9 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -219,7 +219,7 @@ class RepoRootController(BaseController, FeedController):
)
session(t).flush()
allura.tasks.notification_tasks.send_usermentions_notification.post(mr.index_id(),
kw['description'])
- g.director.create_activity(c.user, 'created', mr,
target=mr.app.repo,
+ g.director.create_activity(c.user, 'created', mr, target=mr.app,
related_nodes=[c.project],
tags=['merge-request'])
redirect(mr.url())
diff --git a/Allura/allura/model/repo_refresh.py
b/Allura/allura/model/repo_refresh.py
index 232735c3d..f352a17c0 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -93,7 +93,7 @@ def refresh_repo(repo, all_commits=False, notify=True,
new_clone=False, commits_
g.statsUpdater.newCommit(new, repo.app_config.project, user)
actor = user or TransientActor(
activity_name=new.committed.name or new.committed.email)
- g.director.create_activity(actor, 'committed', new, target=repo,
+ g.director.create_activity(actor, 'committed', new,
target=repo.app,
related_nodes=[repo.app_config.project],
tags=['commit', repo.tool.lower()])
diff --git a/Allura/allura/tasks/repo_tasks.py
b/Allura/allura/tasks/repo_tasks.py
index 3eae80327..42eb6b914 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -160,7 +160,7 @@ def merge(merge_request_id):
mr.app.repo.merge(mr)
mr.add_meta_post(changes={'Status': [mr.status, 'merged']})
mr.status = 'merged'
- g.director.create_activity(c.user, 'merged', mr, target=mr.app.repo,
+ g.director.create_activity(c.user, 'merged', mr, target=mr.app,
related_nodes=[c.project],
tags=['merge-request'])
session(mr).flush(mr)