summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-01-08 17:46:07 +0100
committerMorris Jobke <hey@morrisjobke.de>2019-01-09 18:33:17 +0100
commit194c4b717e4f43b8033da8afc397a1368b3b1812 (patch)
tree7a51872080f7d31906ceb23aa864bbf204e2e76a /apps/dav
parent81b02e34dd07f35e3d66aa91e4a1bf9a57f66db0 (diff)
downloadnextcloud-server-194c4b717e4f43b8033da8afc397a1368b3b1812.tar.gz
nextcloud-server-194c4b717e4f43b8033da8afc397a1368b3b1812.zip
Correctly handle the classification of events in the activity stream
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/Activity/Backend.php10
-rw-r--r--apps/dav/lib/CalDAV/Activity/Provider/Event.php13
2 files changed, 20 insertions, 3 deletions
diff --git a/apps/dav/lib/CalDAV/Activity/Backend.php b/apps/dav/lib/CalDAV/Activity/Backend.php
index 9f929dc195b..89802c2d6fd 100644
--- a/apps/dav/lib/CalDAV/Activity/Backend.php
+++ b/apps/dav/lib/CalDAV/Activity/Backend.php
@@ -27,6 +27,7 @@ namespace OCA\DAV\CalDAV\Activity;
use OCA\DAV\CalDAV\Activity\Provider\Calendar;
use OCA\DAV\CalDAV\Activity\Provider\Event;
+use OCA\DAV\CalDAV\CalDavBackend;
use OCP\Activity\IEvent;
use OCP\Activity\IManager as IActivityManager;
use OCP\IGroup;
@@ -415,6 +416,7 @@ class Backend {
$currentUser = $owner;
}
+ $classification = isset($objectData['classification']) ? $objectData['classification'] : CalDavBackend::CLASSIFICATION_PUBLIC;
$object = $this->getObjectNameAndType($objectData);
$action = $action . '_' . $object['type'];
@@ -434,6 +436,11 @@ class Backend {
$users[] = $owner;
foreach ($users as $user) {
+ if ($classification === CalDavBackend::CLASSIFICATION_PRIVATE && $user !== $owner) {
+ // Private events are only shown to the owner
+ continue;
+ }
+
$event->setAffectedUser($user)
->setSubject(
$user === $currentUser ? $action . '_self' : $action,
@@ -446,7 +453,8 @@ class Backend {
],
'object' => [
'id' => $object['id'],
- 'name' => $object['name'],
+ 'name' => $classification === CalDavBackend::CLASSIFICATION_CONFIDENTIAL && $user !== $owner ? 'Busy' : $object['name'],
+ 'classified' => $classification === CalDavBackend::CLASSIFICATION_CONFIDENTIAL && $user !== $owner,
],
]
);
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php
index f13cb0c266b..67b45b3563d 100644
--- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php
+++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php
@@ -23,6 +23,7 @@
namespace OCA\DAV\CalDAV\Activity\Provider;
+use OCA\DAV\CalDAV\CalDavBackend;
use OCP\Activity\IEvent;
use OCP\Activity\IEventMerger;
use OCP\Activity\IManager;
@@ -131,14 +132,14 @@ class Event extends Base {
return [
'actor' => $this->generateUserParameter($parameters['actor']),
'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l),
- 'event' => $this->generateObjectParameter($parameters['object']),
+ 'event' => $this->generateClassifiedObjectParameter($parameters['object']),
];
case self::SUBJECT_OBJECT_ADD . '_event_self':
case self::SUBJECT_OBJECT_DELETE . '_event_self':
case self::SUBJECT_OBJECT_UPDATE . '_event_self':
return [
'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l),
- 'event' => $this->generateObjectParameter($parameters['object']),
+ 'event' => $this->generateClassifiedObjectParameter($parameters['object']),
];
}
}
@@ -168,4 +169,12 @@ class Event extends Base {
throw new \InvalidArgumentException();
}
+
+ private function generateClassifiedObjectParameter(array $eventData) {
+ $parameter = $this->generateObjectParameter($eventData);
+ if ($eventData['classified']) {
+ $parameter['name'] = $this->l->t('Busy');
+ }
+ return $parameter;
+ }
}