diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml index 9eab8e327087e..8f78d8dcc769c 100644 --- a/apps/dav/appinfo/info.xml +++ b/apps/dav/appinfo/info.xml @@ -60,13 +60,10 @@ OCA\DAV\CalDAV\Activity\Setting\Calendar - OCA\DAV\CalDAV\Activity\Setting\Event - OCA\DAV\CalDAV\Activity\Setting\Todo OCA\DAV\CalDAV\Activity\Filter\Calendar - OCA\DAV\CalDAV\Activity\Filter\Todo diff --git a/apps/dav/composer/composer/autoload_classmap.php b/apps/dav/composer/composer/autoload_classmap.php index b1b01885eef72..89c1ad8ac5866 100644 --- a/apps/dav/composer/composer/autoload_classmap.php +++ b/apps/dav/composer/composer/autoload_classmap.php @@ -22,14 +22,11 @@ 'OCA\\DAV\\BackgroundJob\\UploadCleanup' => $baseDir . '/../lib/BackgroundJob/UploadCleanup.php', 'OCA\\DAV\\CalDAV\\Activity\\Backend' => $baseDir . '/../lib/CalDAV/Activity/Backend.php', 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Filter/Calendar.php', - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Filter/Todo.php', 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => $baseDir . '/../lib/CalDAV/Activity/Provider/Base.php', 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Provider/Calendar.php', 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => $baseDir . '/../lib/CalDAV/Activity/Provider/Event.php', 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Provider/Todo.php', 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => $baseDir . '/../lib/CalDAV/Activity/Setting/Calendar.php', - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => $baseDir . '/../lib/CalDAV/Activity/Setting/Event.php', - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => $baseDir . '/../lib/CalDAV/Activity/Setting/Todo.php', 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => $baseDir . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', 'OCA\\DAV\\CalDAV\\BirthdayService' => $baseDir . '/../lib/CalDAV/BirthdayService.php', 'OCA\\DAV\\CalDAV\\CachedSubscription' => $baseDir . '/../lib/CalDAV/CachedSubscription.php', diff --git a/apps/dav/composer/composer/autoload_static.php b/apps/dav/composer/composer/autoload_static.php index ccd0d41d68baa..75cb3309ceb60 100644 --- a/apps/dav/composer/composer/autoload_static.php +++ b/apps/dav/composer/composer/autoload_static.php @@ -37,14 +37,11 @@ class ComposerStaticInitDAV 'OCA\\DAV\\BackgroundJob\\UploadCleanup' => __DIR__ . '/..' . '/../lib/BackgroundJob/UploadCleanup.php', 'OCA\\DAV\\CalDAV\\Activity\\Backend' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Backend.php', 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Calendar.php', - 'OCA\\DAV\\CalDAV\\Activity\\Filter\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Filter/Todo.php', 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Base' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Base.php', 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Calendar.php', 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Event.php', 'OCA\\DAV\\CalDAV\\Activity\\Provider\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Provider/Todo.php', 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Calendar' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Calendar.php', - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Event' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Event.php', - 'OCA\\DAV\\CalDAV\\Activity\\Setting\\Todo' => __DIR__ . '/..' . '/../lib/CalDAV/Activity/Setting/Todo.php', 'OCA\\DAV\\CalDAV\\BirthdayCalendar\\EnablePlugin' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayCalendar/EnablePlugin.php', 'OCA\\DAV\\CalDAV\\BirthdayService' => __DIR__ . '/..' . '/../lib/CalDAV/BirthdayService.php', 'OCA\\DAV\\CalDAV\\CachedSubscription' => __DIR__ . '/..' . '/../lib/CalDAV/CachedSubscription.php', diff --git a/apps/dav/lib/CalDAV/Activity/Backend.php b/apps/dav/lib/CalDAV/Activity/Backend.php index 16f581db8722c..f36edf57e9787 100644 --- a/apps/dav/lib/CalDAV/Activity/Backend.php +++ b/apps/dav/lib/CalDAV/Activity/Backend.php @@ -430,7 +430,7 @@ public function onTouchCalendarObject($action, array $calendarData, array $share $event = $this->activityManager->generateEvent(); $event->setApp('dav') ->setObject('calendar', (int) $calendarData['id']) - ->setType($object['type'] === 'event' ? 'calendar_event' : 'calendar_todo') + ->setType('calendar') ->setAuthor($currentUser); $users = $this->getUsersForShares($shares); diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php index c2c7ec5d34ae9..ef3991544a5f8 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php @@ -81,7 +81,7 @@ public function getIcon() { * @since 11.0.0 */ public function filterTypes(array $types) { - return array_intersect(['calendar', 'calendar_event'], $types); + return array_intersect(['calendar', 'calendar_event', 'calendar_todo'], $types); } /** diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php b/apps/dav/lib/CalDAV/Activity/Filter/Todo.php deleted file mode 100644 index d361ff389c4a7..0000000000000 --- a/apps/dav/lib/CalDAV/Activity/Filter/Todo.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * @author Joas Schilling - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\DAV\CalDAV\Activity\Filter; - -use OCP\Activity\IFilter; -use OCP\IL10N; -use OCP\IURLGenerator; - -class Todo implements IFilter { - - /** @var IL10N */ - protected $l; - - /** @var IURLGenerator */ - protected $url; - - public function __construct(IL10N $l, IURLGenerator $url) { - $this->l = $l; - $this->url = $url; - } - - /** - * @return string Lowercase a-z and underscore only identifier - * @since 11.0.0 - */ - public function getIdentifier() { - return 'calendar_todo'; - } - - /** - * @return string A translated string - * @since 11.0.0 - */ - public function getName() { - return $this->l->t('Todos'); - } - - /** - * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. - * @since 11.0.0 - */ - public function getPriority() { - return 40; - } - - /** - * @return string Full URL to an icon, empty string when none is given - * @since 11.0.0 - */ - public function getIcon() { - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')); - } - - /** - * @param string[] $types - * @return string[] An array of allowed apps from which activities should be displayed - * @since 11.0.0 - */ - public function filterTypes(array $types) { - return array_intersect(['calendar_todo'], $types); - } - - /** - * @return string[] An array of allowed apps from which activities should be displayed - * @since 11.0.0 - */ - public function allowedApps() { - return []; - } -} diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php index 4aa2c8c0b0ed0..6f1a8e09c97b8 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -119,7 +119,7 @@ protected function generateObjectParameter(array $eventData) { * @since 11.0.0 */ public function parse($language, IEvent $event, IEvent $previousEvent = null) { - if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_event') { + if ($event->getApp() !== 'dav' || ($event->getType() !== 'calendar' && $event->getType() !== 'calendar_event')) { throw new \InvalidArgumentException(); } diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php index 64f542b9f7e19..48369aa4efa66 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php @@ -37,7 +37,7 @@ class Todo extends Event { * @since 11.0.0 */ public function parse($language, IEvent $event, IEvent $previousEvent = null) { - if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') { + if ($event->getApp() !== 'dav' || ($event->getType() !== 'calendar' && $event->getType() !== 'calendar_todo')) { throw new \InvalidArgumentException(); } diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php b/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php index b9475535e4dfe..b658cf00d1ca9 100644 --- a/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Setting/Calendar.php @@ -51,7 +51,7 @@ public function getIdentifier() { * @since 11.0.0 */ public function getName() { - return $this->l->t('A calendar was modified'); + return $this->l->t('A calendar, event or todo was modified'); } /** diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Event.php b/apps/dav/lib/CalDAV/Activity/Setting/Event.php deleted file mode 100644 index 1cd3fc3a051c5..0000000000000 --- a/apps/dav/lib/CalDAV/Activity/Setting/Event.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * @author Joas Schilling - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\DAV\CalDAV\Activity\Setting; - -use OCP\Activity\ISetting; -use OCP\IL10N; - -class Event implements ISetting { - - /** @var IL10N */ - protected $l; - - /** - * @param IL10N $l - */ - public function __construct(IL10N $l) { - $this->l = $l; - } - - /** - * @return string Lowercase a-z and underscore only identifier - * @since 11.0.0 - */ - public function getIdentifier() { - return 'calendar_event'; - } - - /** - * @return string A translated string - * @since 11.0.0 - */ - public function getName() { - return $this->l->t('A calendar event was modified'); - } - - /** - * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. - * @since 11.0.0 - */ - public function getPriority() { - return 50; - } - - /** - * @return bool True when the option can be changed for the stream - * @since 11.0.0 - */ - public function canChangeStream() { - return true; - } - - /** - * @return bool True when the option can be changed for the stream - * @since 11.0.0 - */ - public function isDefaultEnabledStream() { - return true; - } - - /** - * @return bool True when the option can be changed for the mail - * @since 11.0.0 - */ - public function canChangeMail() { - return true; - } - - /** - * @return bool True when the option can be changed for the stream - * @since 11.0.0 - */ - public function isDefaultEnabledMail() { - return false; - } -} diff --git a/apps/dav/lib/CalDAV/Activity/Setting/Todo.php b/apps/dav/lib/CalDAV/Activity/Setting/Todo.php deleted file mode 100644 index 2dfc85957c6eb..0000000000000 --- a/apps/dav/lib/CalDAV/Activity/Setting/Todo.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * @author Joas Schilling - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\DAV\CalDAV\Activity\Setting; - -use OCP\Activity\ISetting; -use OCP\IL10N; - -class Todo implements ISetting { - - /** @var IL10N */ - protected $l; - - /** - * @param IL10N $l - */ - public function __construct(IL10N $l) { - $this->l = $l; - } - - /** - * @return string Lowercase a-z and underscore only identifier - * @since 11.0.0 - */ - public function getIdentifier() { - return 'calendar_todo'; - } - - /** - * @return string A translated string - * @since 11.0.0 - */ - public function getName() { - return $this->l->t('A calendar todo was modified'); - } - - /** - * @return int whether the filter should be rather on the top or bottom of - * the admin section. The filters are arranged in ascending order of the - * priority values. It is required to return a value between 0 and 100. - * @since 11.0.0 - */ - public function getPriority() { - return 50; - } - - /** - * @return bool True when the option can be changed for the stream - * @since 11.0.0 - */ - public function canChangeStream() { - return true; - } - - /** - * @return bool True when the option can be changed for the stream - * @since 11.0.0 - */ - public function isDefaultEnabledStream() { - return true; - } - - /** - * @return bool True when the option can be changed for the mail - * @since 11.0.0 - */ - public function canChangeMail() { - return true; - } - - /** - * @return bool True when the option can be changed for the stream - * @since 11.0.0 - */ - public function isDefaultEnabledMail() { - return false; - } -} diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php index 1e0fbe7b98414..402f75282d61e 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php @@ -73,7 +73,7 @@ public function dataFilterTypes() { return [ [[], []], [['calendar', 'calendar_event'], ['calendar', 'calendar_event']], - [['calendar', 'calendar_event', 'calendar_todo'], ['calendar', 'calendar_event']], + [['calendar', 'calendar_event', 'calendar_todo'], ['calendar', 'calendar_event', 'calendar_todo']], [['calendar', 'calendar_event', 'files'], ['calendar', 'calendar_event']], ]; } diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php index 7cc02ee008c03..0a067fa6338fa 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php @@ -25,7 +25,6 @@ namespace OCA\DAV\Tests\unit\CalDAV\Activity\Filter; use OCA\DAV\CalDAV\Activity\Filter\Calendar; -use OCA\DAV\CalDAV\Activity\Filter\Todo; use OCP\Activity\IFilter; use Test\TestCase; @@ -36,7 +35,6 @@ class GenericTest extends TestCase { public function dataFilters() { return [ [Calendar::class], - [Todo::class], ]; } diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php deleted file mode 100644 index a44c9b5abbf02..0000000000000 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/TodoTest.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * @author Christoph Wurst - * @author Joas Schilling - * @author Roeland Jago Douma - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\DAV\Tests\unit\CalDAV\Activity\Filter; - -use OCA\DAV\CalDAV\Activity\Filter\Todo; -use OCP\Activity\IFilter; -use OCP\IL10N; -use OCP\IURLGenerator; -use Test\TestCase; - -class TodoTest extends TestCase { - - /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ - protected $url; - - /** @var IFilter|\PHPUnit_Framework_MockObject_MockObject */ - protected $filter; - - protected function setUp(): void { - parent::setUp(); - $this->url = $this->createMock(IURLGenerator::class); - $l = $this->createMock(IL10N::class); - $l->expects($this->any()) - ->method('t') - ->willReturnCallback(function ($string, $args) { - return vsprintf($string, $args); - }); - - $this->filter = new Todo( - $l, $this->url - ); - } - - public function testGetIcon() { - $this->url->expects($this->once()) - ->method('imagePath') - ->with('core', 'actions/checkmark.svg') - ->willReturn('path-to-icon'); - - $this->url->expects($this->once()) - ->method('getAbsoluteURL') - ->with('path-to-icon') - ->willReturn('absolute-path-to-icon'); - - $this->assertEquals('absolute-path-to-icon', $this->filter->getIcon()); - } - - public function dataFilterTypes() { - return [ - [[], []], - [['calendar_todo'], ['calendar_todo']], - [['calendar', 'calendar_event', 'calendar_todo'], ['calendar_todo']], - [['calendar', 'calendar_todo', 'files'], ['calendar_todo']], - ]; - } - - /** - * @dataProvider dataFilterTypes - * @param string[] $types - * @param string[] $expected - */ - public function testFilterTypes($types, $expected) { - $this->assertEquals($expected, $this->filter->filterTypes($types)); - } -} diff --git a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php index 44c05e8b0a5d9..27dd0d4f42f46 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php @@ -34,8 +34,6 @@ class GenericTest extends TestCase { public function dataSettings() { return [ [Calendar::class], - [Event::class], - [Todo::class], ]; }