summaryrefslogtreecommitdiffstats
path: root/lib/private/Activity/Manager.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-10-28 14:55:53 +0200
committerJoas Schilling <coding@schilljs.com>2016-11-16 09:25:45 +0100
commit72f0d9981eca7b1be5832ea2d1a0cbd9526e85a4 (patch)
tree993ef2a9915bcdd8b9ebb8e3ecbc8015abccb918 /lib/private/Activity/Manager.php
parenta366602961769f2b7a5d3947a61713efde38cc2f (diff)
downloadnextcloud-server-72f0d9981eca7b1be5832ea2d1a0cbd9526e85a4.tar.gz
nextcloud-server-72f0d9981eca7b1be5832ea2d1a0cbd9526e85a4.zip
Add ROS and icon support to the events
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Activity/Manager.php')
-rw-r--r--lib/private/Activity/Manager.php21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php
index 60a4a935898..c0e75b12091 100644
--- a/lib/private/Activity/Manager.php
+++ b/lib/private/Activity/Manager.php
@@ -24,6 +24,7 @@
namespace OC\Activity;
+use OC\RichObjectStrings\Validator;
use OCP\Activity\IConsumer;
use OCP\Activity\IEvent;
use OCP\Activity\IExtension;
@@ -149,7 +150,9 @@ class Manager implements IManager {
* @return IEvent
*/
public function generateEvent() {
- return new Event();
+ return new Event(
+ new Validator()
+ );
}
/**
@@ -166,18 +169,6 @@ class Manager implements IManager {
* @throws \BadMethodCallException if required values have not been set
*/
public function publish(IEvent $event) {
- if (!$event->getApp()) {
- throw new \BadMethodCallException('App not set', 10);
- }
- if (!$event->getType()) {
- throw new \BadMethodCallException('Type not set', 11);
- }
- if ($event->getAffectedUser() === null) {
- throw new \BadMethodCallException('Affected user not set', 12);
- }
- if ($event->getSubject() === null || $event->getSubjectParameters() === null) {
- throw new \BadMethodCallException('Subject not set', 13);
- }
if ($event->getAuthor() === null) {
if ($this->session->getUser() instanceof IUser) {
@@ -189,6 +180,10 @@ class Manager implements IManager {
$event->setTimestamp(time());
}
+ if (!$event->isValid()) {
+ throw new \BadMethodCallException('The given event is invalid');
+ }
+
foreach ($this->getConsumers() as $c) {
$c->receive($event);
}