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

github.com/nextcloud/calendar.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvinash Gusain <avinashg@e.email>2022-10-27 18:52:30 +0300
committerAvinash Gusain <avinashg@e.email>2022-10-27 19:15:19 +0300
commit2c084474ba051bca65a17b82c9a6c9e832fe3d5a (patch)
tree3d38050b3942427966d37dcf8c45bfdd9ffaac25
parentfd86c3729ecee3e7801c74b16e60d67619ab68cd (diff)
repair step removed
Signed-off-by: Avinash Gusain <avinashg@e.email>
-rw-r--r--appinfo/info.xml5
-rw-r--r--lib/RepairSteps/CurrentViewNameRepairStep.php96
-rw-r--r--tests/php/unit/RepairSteps/CurrentViewNameRepairStepTest.php124
3 files changed, 0 insertions, 225 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index b6afdb3d..daee54cc 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -38,11 +38,6 @@
<background-jobs>
<job>OCA\Calendar\BackgroundJob\CleanUpOutdatedBookingsJob</job>
</background-jobs>
- <repair-steps>
- <post-migration>
- <step>OCA\Calendar\RepairSteps\CurrentViewNameRepairStep</step>
- </post-migration>
- </repair-steps>
<navigations>
<navigation>
<id>calendar</id>
diff --git a/lib/RepairSteps/CurrentViewNameRepairStep.php b/lib/RepairSteps/CurrentViewNameRepairStep.php
deleted file mode 100644
index 58c69129..00000000
--- a/lib/RepairSteps/CurrentViewNameRepairStep.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-declare(strict_types=1);
-/**
- * Calendar App
- *
- * @author Georg Ehrke
- *
- * @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library 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 library. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-namespace OCA\Calendar\RepairSteps;
-
-use OCP\IConfig;
-use OCP\IUser;
-use OCP\IUserManager;
-use OCP\Migration\IOutput;
-use OCP\Migration\IRepairStep;
-
-/**
- * Class CurrentViewNameRepairStep
- *
- * @package OCA\Calendar\RepairSteps
- */
-class CurrentViewNameRepairStep implements IRepairStep {
-
- /** @var IUserManager */
- private $userManager;
-
- /** @var IConfig */
- private $config;
-
- /**
- * CurrentViewNameRepairStep constructor.
- *
- * @param IUserManager $userManager
- * @param IConfig $config
- */
- public function __construct(IUserManager $userManager,
- IConfig $config) {
- $this->userManager = $userManager;
- $this->config = $config;
- }
-
- /**
- * @return string
- */
- public function getName():string {
- return 'Update name of the stored view';
- }
-
- /**
- * @param IOutput $output
- */
- public function run(IOutput $output):void {
- $this->userManager->callForSeenUsers(function (IUser $user) {
- $userId = $user->getUID();
- $savedView = $this->config->getUserValue($userId, 'calendar', 'currentView', null);
-
- if ($savedView === null) {
- return;
- }
- if (\in_array($savedView, ['timeGridDay', 'timeGridWeek', 'dayGridMonth'], true)) {
- return;
- }
-
- switch ($savedView) {
- case 'agendaDay':
- $this->config->setUserValue($userId, 'calendar', 'currentView', 'timeGridDay');
- break;
-
- case 'agendaWeek':
- $this->config->setUserValue($userId, 'calendar', 'currentView', 'timeGridWeek');
- break;
-
- case 'month':
- default:
- $this->config->setUserValue($userId, 'calendar', 'currentView', 'dayGridMonth');
- break;
- }
- });
- }
-}
diff --git a/tests/php/unit/RepairSteps/CurrentViewNameRepairStepTest.php b/tests/php/unit/RepairSteps/CurrentViewNameRepairStepTest.php
deleted file mode 100644
index 919b8122..00000000
--- a/tests/php/unit/RepairSteps/CurrentViewNameRepairStepTest.php
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-
-declare(strict_types=1);
-/**
- * Calendar App
- *
- * @author Georg Ehrke
- * @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library 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 library. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-namespace OCA\Calendar\RepairSteps;
-
-use OCP\IConfig;
-use OCP\IUser;
-use OCP\IUserManager;
-use OCP\Migration\IOutput;
-use ChristophWurst\Nextcloud\Testing\TestCase;
-
-class CurrentViewNameRepairStepTest extends TestCase {
-
- /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
- private $userManager;
-
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
- private $config;
-
- /** @var CurrentViewNameRepairStep */
- private $repairStep;
-
- protected function setUp():void {
- parent::setUp();
-
- $this->userManager = $this->createMock(IUserManager::class);
- $this->config = $this->createMock(IConfig::class);
-
- $this->repairStep = new CurrentViewNameRepairStep($this->userManager,
- $this->config);
- }
-
- public function testGetName():void {
- $this->assertEquals('Update name of the stored view', $this->repairStep->getName());
- }
-
- public function testRun():void {
- $this->userManager->expects($this->once())
- ->method('callForSeenUsers')
- ->with($this->callback(function ($fn) {
- $user1 = $this->createMock(IUser::class);
- $user1->method('getUID')->willReturn('user1');
-
- $user2 = $this->createMock(IUser::class);
- $user2->method('getUID')->willReturn('user2');
-
- $user3 = $this->createMock(IUser::class);
- $user3->method('getUID')->willReturn('user3');
-
- $user4 = $this->createMock(IUser::class);
- $user4->method('getUID')->willReturn('user4');
-
- $user5 = $this->createMock(IUser::class);
- $user5->method('getUID')->willReturn('user5');
-
- $user6 = $this->createMock(IUser::class);
- $user6->method('getUID')->willReturn('user6');
-
- $user7 = $this->createMock(IUser::class);
- $user7->method('getUID')->willReturn('user7');
-
- $user8 = $this->createMock(IUser::class);
- $user8->method('getUID')->willReturn('user8');
-
- $fn($user1);
- $fn($user2);
- $fn($user3);
- $fn($user4);
- $fn($user5);
- $fn($user6);
- $fn($user7);
- $fn($user8);
-
- return true;
- }));
-
- $this->config
- ->method('getUserValue')
- ->willReturnMap([
- ['user1', 'calendar', 'currentView', null, 'agendaDay'],
- ['user2', 'calendar', 'currentView', null, 'agendaWeek'],
- ['user3', 'calendar', 'currentView', null, 'month'],
- ['user4', 'calendar', 'currentView', null, 'otherView'],
- ['user5', 'calendar', 'currentView', null, null],
- ['user7', 'calendar', 'currentView', null, 'timeGridWeek'],
- ]);
- $this->config
- ->method('setUserValue')
- ->withConsecutive(
- ['user1', 'calendar', 'currentView', 'timeGridDay'],
- ['user2', 'calendar', 'currentView', 'timeGridWeek'],
- ['user3', 'calendar', 'currentView', 'dayGridMonth'],
- ['user4', 'calendar', 'currentView', 'dayGridMonth'],
- ['user6', 'calendar', 'currentView', null],
- ['user8', 'calendar', 'currentView', null, 'dayGridMonth']
- );
-
- $output = $this->createMock(IOutput::class);
- $output->expects($this->never())
- ->method($this->anything());
-
- $this->repairStep->run($output);
- }
-}