Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbrantje <brantje@gmail.com>2016-12-21 16:41:43 +0300
committerbrantje <brantje@gmail.com>2016-12-21 16:41:43 +0300
commitfc3c019895e0c604c88c1d622656811bc3d73e35 (patch)
treef060e53e8a977481a9d0f86dfb6a0111af095b4e /lib
parent7d378e681b3b89041008933ea7795d4adeb70419 (diff)
Don't publish an activity if there is no user
Signed-off-by: brantje <brantje@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/ActivityService.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/Service/ActivityService.php b/lib/Service/ActivityService.php
index 3a10d56a..f941a8af 100644
--- a/lib/Service/ActivityService.php
+++ b/lib/Service/ActivityService.php
@@ -51,16 +51,17 @@ class ActivityService {
public function add($subject,$subjectParams=array(),
$message='',$messageParams=array(),
$link='',$user=null,$type='') {
- $activity = $this->manager->generateEvent();
- $activity->setType($type);
- $activity->setApp('passman');
- $activity->setSubject($subject, $subjectParams);
- $activity->setLink($link);
- $activity->setAffectedUser($user);
- $activity->setAuthor($user);
- $activity->setTimestamp(time());
- $activity->setMessage($message, $messageParams);
- print_r($this->manager->publish($activity));
+ if($user) {
+ $activity = $this->manager->generateEvent();
+ $activity->setType($type);
+ $activity->setApp('passman');
+ $activity->setSubject($subject, $subjectParams);
+ $activity->setLink($link);
+ $activity->setAffectedUser($user);
+ $activity->setAuthor($user);
+ $activity->setTimestamp(time());
+ $activity->setMessage($message, $messageParams);
+ }
return array('success'=>'ok');
}
} \ No newline at end of file