summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-01-08 17:46:07 +0100
committerJoas Schilling <coding@schilljs.com>2019-01-09 13:17:37 +0100
commit10dec5ff98d929d92c1e01fc545115a797fde4c9 (patch)
tree4dc95a569e68499a8d1a06080cf144eb90d968c2 /apps
parent32adb9c66f9824f5a5c7d870797b785c44dd5caa (diff)
downloadnextcloud-server-10dec5ff98d929d92c1e01fc545115a797fde4c9.tar.gz
nextcloud-server-10dec5ff98d929d92c1e01fc545115a797fde4c9.zip
Correctly handle the classification of events in the activity stream
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-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..73bd9b5dafc 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 = $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 378a18397ec..666660cdb1b 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;
+ }
}