From 39ef0500d1d9b2d16540c7548100181e535f2a31 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 12 May 2022 09:23:26 +0200 Subject: Handle the move operation properly between shared calendars - Introduce a new CalendarObjectMovedEvent typed event dedicated for this operation - Handle the event in the activity backend and add new appropriate activity subjects Signed-off-by: Thomas Citharel --- apps/dav/lib/CalDAV/Activity/Provider/Todo.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'apps/dav/lib/CalDAV/Activity/Provider/Todo.php') diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php index a3ab81e38ae..4b2796aca53 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php @@ -69,6 +69,10 @@ class Todo extends Event { $subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}'); } elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') { $subject = $this->l->t('You reopened todo {todo} in list {calendar}'); + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_MOVE . '_todo') { + $subject = $this->l->t('{actor} moved todo {todo} from list {sourceCalendar} to list {targetCalendar}'); + } elseif ($event->getSubject() === self::SUBJECT_OBJECT_MOVE . '_todo_self') { + $subject = $this->l->t('You moved todo {todo} from list {sourceCalendar} to list {targetCalendar}'); } else { throw new \InvalidArgumentException(); } @@ -114,6 +118,24 @@ class Todo extends Event { } } + if (isset($parameters['sourceCalendar']) && isset($parameters['targetCalendar'])) { + switch ($subject) { + case self::SUBJECT_OBJECT_MOVE . '_todo': + return [ + 'actor' => $this->generateUserParameter($parameters['actor']), + 'sourceCalendar' => $this->generateCalendarParameter($parameters['sourceCalendar'], $this->l), + 'targetCalendar' => $this->generateCalendarParameter($parameters['targetCalendar'], $this->l), + 'todo' => $this->generateObjectParameter($parameters['object']), + ]; + case self::SUBJECT_OBJECT_MOVE . '_todo_self': + return [ + 'sourceCalendar' => $this->generateCalendarParameter($parameters['sourceCalendar'], $this->l), + 'targetCalendar' => $this->generateCalendarParameter($parameters['targetCalendar'], $this->l), + 'todo' => $this->generateObjectParameter($parameters['object']), + ]; + } + } + // Legacy - Do NOT Remove unless necessary // Removing this will break parsing of activities that were created on // Nextcloud 12, so we should keep this as long as it's acceptable. -- cgit v1.2.3