summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-11-25 15:21:16 +0100
committerJoas Schilling <coding@schilljs.com>2016-11-25 15:36:11 +0100
commitda9468522b9e846d10b6e91ad10fa0c1b3b99546 (patch)
tree363cc86558aef303a02ffcf539171847c01a6a62 /apps/files
parent5ba2b1c193e36cc3f5d029cf80fb267b5ab6cfa3 (diff)
downloadnextcloud-server-da9468522b9e846d10b6e91ad10fa0c1b3b99546.tar.gz
nextcloud-server-da9468522b9e846d10b6e91ad10fa0c1b3b99546.zip
Add an event merger and use it for the files activities
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/lib/Activity/Provider.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php
index 5cec2711620..863e7644059 100644
--- a/apps/files/lib/Activity/Provider.php
+++ b/apps/files/lib/Activity/Provider.php
@@ -22,6 +22,7 @@
namespace OCA\Files\Activity;
use OCP\Activity\IEvent;
+use OCP\Activity\IEventMerger;
use OCP\Activity\IManager;
use OCP\Activity\IProvider;
use OCP\IL10N;
@@ -43,6 +44,9 @@ class Provider implements IProvider {
/** @var IUserManager */
protected $userManager;
+ /** @var IEventMerger */
+ protected $eventMerger;
+
/** @var string[] cached displayNames - key is the UID and value the displayname */
protected $displayNames = [];
@@ -51,12 +55,14 @@ class Provider implements IProvider {
* @param IURLGenerator $url
* @param IManager $activityManager
* @param IUserManager $userManager
+ * @param IEventMerger $eventMerger
*/
- public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager) {
+ public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) {
$this->l = $l;
$this->url = $url;
$this->activityManager = $activityManager;
$this->userManager = $userManager;
+ $this->eventMerger = $eventMerger;
}
/**
@@ -115,6 +121,8 @@ class Provider implements IProvider {
$this->setSubjects($event, $subject, $parsedParameters);
+ $event = $this->eventMerger->mergeEvents('user', $event, $previousEvent);
+
return $event;
}
@@ -171,6 +179,13 @@ class Provider implements IProvider {
$this->setSubjects($event, $subject, $parsedParameters);
+ $event = $this->eventMerger->mergeEvents('file', $event, $previousEvent);
+
+ if ($event->getChildEvent() === null) {
+ // Couldn't group by file, maybe we can group by user
+ $event = $this->eventMerger->mergeEvents('user', $event, $previousEvent);
+ }
+
return $event;
}