Passed
Push — master ( c6645c...a05176 )
by John
17:56 queued 13s
created
apps/cloud_federation_api/lib/Config.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -33,26 +33,26 @@
 block discarded – undo
33 33
  */
34 34
 class Config {
35 35
 
36
-	/** @var ICloudFederationProviderManager */
37
-	private $cloudFederationProviderManager;
36
+    /** @var ICloudFederationProviderManager */
37
+    private $cloudFederationProviderManager;
38 38
 
39
-	public function __construct(ICloudFederationProviderManager $cloudFederationProviderManager) {
40
-		$this->cloudFederationProviderManager = $cloudFederationProviderManager;
41
-	}
39
+    public function __construct(ICloudFederationProviderManager $cloudFederationProviderManager) {
40
+        $this->cloudFederationProviderManager = $cloudFederationProviderManager;
41
+    }
42 42
 
43
-	/**
44
-	 * get a list of supported share types
45
-	 *
46
-	 * @param string $resourceType
47
-	 * @return array
48
-	 */
49
-	public function getSupportedShareTypes($resourceType) {
50
-		try {
51
-			$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
52
-			return $provider->getSupportedShareTypes();
53
-		} catch (\Exception $e) {
54
-			return [];
55
-		}
56
-	}
43
+    /**
44
+     * get a list of supported share types
45
+     *
46
+     * @param string $resourceType
47
+     * @return array
48
+     */
49
+    public function getSupportedShareTypes($resourceType) {
50
+        try {
51
+            $provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
52
+            return $provider->getSupportedShareTypes();
53
+        } catch (\Exception $e) {
54
+            return [];
55
+        }
56
+    }
57 57
 
58 58
 }
Please login to merge, or discard this patch.
core/Command/Group/Add.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$gid = $input->getArgument('groupid');
66 66
 		$group = $this->groupManager->get($gid);
67 67
 		if ($group) {
68
-			$output->writeln('<error>Group "' . $gid . '" already exists.</error>');
68
+			$output->writeln('<error>Group "'.$gid.'" already exists.</error>');
69 69
 			return 1;
70 70
 		} else {
71 71
 			$group = $this->groupManager->createGroup($gid);
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 				$output->writeln('<error>Could not create group</error>');
74 74
 				return 2;
75 75
 			}
76
-			$output->writeln('Created group "' . $group->getGID() . '"');
76
+			$output->writeln('Created group "'.$group->getGID().'"');
77 77
 
78
-			$displayName = trim((string)$input->getOption('display-name'));
78
+			$displayName = trim((string) $input->getOption('display-name'));
79 79
 			if ($displayName !== '') {
80 80
 				$group->setDisplayName($displayName);
81 81
 			}
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -36,49 +36,49 @@
 block discarded – undo
36 36
 use Symfony\Component\Console\Output\OutputInterface;
37 37
 
38 38
 class Add extends Base {
39
-	protected IGroupManager $groupManager;
39
+    protected IGroupManager $groupManager;
40 40
 
41
-	public function __construct(IGroupManager $groupManager) {
42
-		$this->groupManager = $groupManager;
43
-		parent::__construct();
44
-	}
41
+    public function __construct(IGroupManager $groupManager) {
42
+        $this->groupManager = $groupManager;
43
+        parent::__construct();
44
+    }
45 45
 
46
-	protected function configure() {
47
-		$this
48
-			->setName('group:add')
49
-			->setDescription('Add a group')
50
-			->addArgument(
51
-				'groupid',
52
-				InputArgument::REQUIRED,
53
-				'Group id'
54
-			)
55
-			->addOption(
56
-				'display-name',
57
-				null,
58
-				InputOption::VALUE_REQUIRED,
59
-				'Group name used in the web UI (can contain any characters)'
60
-			);
61
-	}
46
+    protected function configure() {
47
+        $this
48
+            ->setName('group:add')
49
+            ->setDescription('Add a group')
50
+            ->addArgument(
51
+                'groupid',
52
+                InputArgument::REQUIRED,
53
+                'Group id'
54
+            )
55
+            ->addOption(
56
+                'display-name',
57
+                null,
58
+                InputOption::VALUE_REQUIRED,
59
+                'Group name used in the web UI (can contain any characters)'
60
+            );
61
+    }
62 62
 
63
-	protected function execute(InputInterface $input, OutputInterface $output): int {
64
-		$gid = $input->getArgument('groupid');
65
-		$group = $this->groupManager->get($gid);
66
-		if ($group) {
67
-			$output->writeln('<error>Group "' . $gid . '" already exists.</error>');
68
-			return 1;
69
-		} else {
70
-			$group = $this->groupManager->createGroup($gid);
71
-			if (!$group instanceof IGroup) {
72
-				$output->writeln('<error>Could not create group</error>');
73
-				return 2;
74
-			}
75
-			$output->writeln('Created group "' . $group->getGID() . '"');
63
+    protected function execute(InputInterface $input, OutputInterface $output): int {
64
+        $gid = $input->getArgument('groupid');
65
+        $group = $this->groupManager->get($gid);
66
+        if ($group) {
67
+            $output->writeln('<error>Group "' . $gid . '" already exists.</error>');
68
+            return 1;
69
+        } else {
70
+            $group = $this->groupManager->createGroup($gid);
71
+            if (!$group instanceof IGroup) {
72
+                $output->writeln('<error>Could not create group</error>');
73
+                return 2;
74
+            }
75
+            $output->writeln('Created group "' . $group->getGID() . '"');
76 76
 
77
-			$displayName = trim((string)$input->getOption('display-name'));
78
-			if ($displayName !== '') {
79
-				$group->setDisplayName($displayName);
80
-			}
81
-		}
82
-		return 0;
83
-	}
77
+            $displayName = trim((string)$input->getOption('display-name'));
78
+            if ($displayName !== '') {
79
+                $group->setDisplayName($displayName);
80
+            }
81
+        }
82
+        return 0;
83
+    }
84 84
 }
Please login to merge, or discard this patch.
apps/systemtags/lib/Settings/Admin.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,29 +29,29 @@
 block discarded – undo
29 29
 
30 30
 class Admin implements ISettings {
31 31
 
32
-	/**
33
-	 * @return TemplateResponse
34
-	 */
35
-	public function getForm() {
36
-		return new TemplateResponse('systemtags', 'admin', [], '');
37
-	}
32
+    /**
33
+     * @return TemplateResponse
34
+     */
35
+    public function getForm() {
36
+        return new TemplateResponse('systemtags', 'admin', [], '');
37
+    }
38 38
 
39
-	/**
40
-	 * @return string the section ID, e.g. 'sharing'
41
-	 */
42
-	public function getSection() {
43
-		return 'server';
44
-	}
39
+    /**
40
+     * @return string the section ID, e.g. 'sharing'
41
+     */
42
+    public function getSection() {
43
+        return 'server';
44
+    }
45 45
 
46
-	/**
47
-	 * @return int whether the form should be rather on the top or bottom of
48
-	 * the admin section. The forms are arranged in ascending order of the
49
-	 * priority values. It is required to return a value between 0 and 100.
50
-	 *
51
-	 * E.g.: 70
52
-	 */
53
-	public function getPriority() {
54
-		return 70;
55
-	}
46
+    /**
47
+     * @return int whether the form should be rather on the top or bottom of
48
+     * the admin section. The forms are arranged in ascending order of the
49
+     * priority values. It is required to return a value between 0 and 100.
50
+     *
51
+     * E.g.: 70
52
+     */
53
+    public function getPriority() {
54
+        return 70;
55
+    }
56 56
 
57 57
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Settings/Section.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -29,45 +29,45 @@
 block discarded – undo
29 29
 use OCP\Settings\IIconSection;
30 30
 
31 31
 class Section implements IIconSection {
32
-	/** @var IL10N */
33
-	private $l;
34
-	/** @var IURLGenerator */
35
-	private $url;
32
+    /** @var IL10N */
33
+    private $l;
34
+    /** @var IURLGenerator */
35
+    private $url;
36 36
 
37
-	/**
38
-	 * @param IURLGenerator $url
39
-	 * @param IL10N $l
40
-	 */
41
-	public function __construct(IURLGenerator $url, IL10N $l) {
42
-		$this->url = $url;
43
-		$this->l = $l;
44
-	}
37
+    /**
38
+     * @param IURLGenerator $url
39
+     * @param IL10N $l
40
+     */
41
+    public function __construct(IURLGenerator $url, IL10N $l) {
42
+        $this->url = $url;
43
+        $this->l = $l;
44
+    }
45 45
 
46
-	/**
47
-	 * {@inheritdoc}
48
-	 */
49
-	public function getID() {
50
-		return 'workflow';
51
-	}
46
+    /**
47
+     * {@inheritdoc}
48
+     */
49
+    public function getID() {
50
+        return 'workflow';
51
+    }
52 52
 
53
-	/**
54
-	 * {@inheritdoc}
55
-	 */
56
-	public function getName() {
57
-		return $this->l->t('Flow');
58
-	}
53
+    /**
54
+     * {@inheritdoc}
55
+     */
56
+    public function getName() {
57
+        return $this->l->t('Flow');
58
+    }
59 59
 
60
-	/**
61
-	 * {@inheritdoc}
62
-	 */
63
-	public function getPriority() {
64
-		return 55;
65
-	}
60
+    /**
61
+     * {@inheritdoc}
62
+     */
63
+    public function getPriority() {
64
+        return 55;
65
+    }
66 66
 
67
-	/**
68
-	 * {@inheritdoc}
69
-	 */
70
-	public function getIcon() {
71
-		return $this->url->imagePath(Application::APP_ID, 'app-dark.svg');
72
-	}
67
+    /**
68
+     * {@inheritdoc}
69
+     */
70
+    public function getIcon() {
71
+        return $this->url->imagePath(Application::APP_ID, 'app-dark.svg');
72
+    }
73 73
 }
Please login to merge, or discard this patch.
lib/public/WorkflowEngine/EntityContext/IUrl.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
  * @since 18.0.0
33 33
  */
34 34
 interface IUrl {
35
-	/**
36
-	 * returns a URL that is related to the entity, e.g. the link to a share
37
-	 *
38
-	 * @since 18.0.0
39
-	 */
40
-	public function getUrl(): string;
35
+    /**
36
+     * returns a URL that is related to the entity, e.g. the link to a share
37
+     *
38
+     * @since 18.0.0
39
+     */
40
+    public function getUrl(): string;
41 41
 }
Please login to merge, or discard this patch.
lib/public/WorkflowEngine/EntityContext/IDisplayName.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
  * @since 18.0.0
33 33
  */
34 34
 interface IDisplayName {
35
-	/**
36
-	 * returns the end user facing name of the object related to the entity
37
-	 *
38
-	 * @since 18.0.0
39
-	 */
40
-	public function getDisplayName(): string;
35
+    /**
36
+     * returns the end user facing name of the object related to the entity
37
+     *
38
+     * @since 18.0.0
39
+     */
40
+    public function getDisplayName(): string;
41 41
 }
Please login to merge, or discard this patch.
lib/public/WorkflowEngine/EntityContext/IIcon.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
  * @since 18.0.0
33 33
  */
34 34
 interface IIcon {
35
-	/**
36
-	 * returns a URL to an icon that is related to the entity, for instance
37
-	 * a group icon for groups.
38
-	 *
39
-	 * @since 18.0.0
40
-	 */
41
-	public function getIconUrl(): string;
35
+    /**
36
+     * returns a URL to an icon that is related to the entity, for instance
37
+     * a group icon for groups.
38
+     *
39
+     * @since 18.0.0
40
+     */
41
+    public function getIconUrl(): string;
42 42
 }
Please login to merge, or discard this patch.
apps/files/lib/Db/TransferOwnership.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,24 +37,24 @@
 block discarded – undo
37 37
  * @method string getNodeName()
38 38
  */
39 39
 class TransferOwnership extends Entity {
40
-	/** @var string */
41
-	protected $sourceUser;
40
+    /** @var string */
41
+    protected $sourceUser;
42 42
 
43
-	/** @var string */
44
-	protected $targetUser;
43
+    /** @var string */
44
+    protected $targetUser;
45 45
 
46
-	/** @var integer */
47
-	protected $fileId;
46
+    /** @var integer */
47
+    protected $fileId;
48 48
 
49
-	/** @var string */
50
-	protected $nodeName;
49
+    /** @var string */
50
+    protected $nodeName;
51 51
 
52
-	public function __construct() {
53
-		$this->addType('sourceUser', 'string');
54
-		$this->addType('targetUser', 'string');
55
-		$this->addType('fileId', 'integer');
56
-		$this->addType('nodeName', 'string');
57
-	}
52
+    public function __construct() {
53
+        $this->addType('sourceUser', 'string');
54
+        $this->addType('targetUser', 'string');
55
+        $this->addType('fileId', 'integer');
56
+        $this->addType('nodeName', 'string');
57
+    }
58 58
 
59 59
 
60 60
 }
Please login to merge, or discard this patch.
apps/files/lib/BackgroundJob/TransferOwnership.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$destinationUserObject = $this->userManager->get($destinationUser);
99 99
 
100 100
 		if (!$sourceUserObject instanceof IUser) {
101
-			$this->logger->alert('Could not transfer ownership: Unknown source user ' . $sourceUser);
101
+			$this->logger->alert('Could not transfer ownership: Unknown source user '.$sourceUser);
102 102
 			$this->failedNotication($transfer);
103 103
 			return;
104 104
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 				'targetUser' => $transfer->getTargetUser(),
137 137
 				'nodeName' => $transfer->getNodeName(),
138 138
 			])
139
-			->setObject('transfer', (string)$transfer->getId());
139
+			->setObject('transfer', (string) $transfer->getId());
140 140
 		$this->notificationManager->notify($notification);
141 141
 
142 142
 		// Send notification to source user
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 				'targetUser' => $transfer->getTargetUser(),
150 150
 				'nodeName' => $transfer->getNodeName(),
151 151
 			])
152
-			->setObject('transfer', (string)$transfer->getId());
152
+			->setObject('transfer', (string) $transfer->getId());
153 153
 		$this->notificationManager->notify($notification);
154 154
 	}
155 155
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				'targetUser' => $transfer->getTargetUser(),
165 165
 				'nodeName' => $transfer->getNodeName(),
166 166
 			])
167
-			->setObject('transfer', (string)$transfer->getId());
167
+			->setObject('transfer', (string) $transfer->getId());
168 168
 		$this->notificationManager->notify($notification);
169 169
 
170 170
 		// Send notification to source user
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 				'targetUser' => $transfer->getTargetUser(),
178 178
 				'nodeName' => $transfer->getNodeName(),
179 179
 			])
180
-			->setObject('transfer', (string)$transfer->getId());
180
+			->setObject('transfer', (string) $transfer->getId());
181 181
 		$this->notificationManager->notify($notification);
182 182
 	}
183 183
 }
Please login to merge, or discard this patch.
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -42,141 +42,141 @@
 block discarded – undo
42 42
 
43 43
 class TransferOwnership extends QueuedJob {
44 44
 
45
-	/** @var IUserManager $userManager */
46
-	private $userManager;
47
-
48
-	/** @var OwnershipTransferService */
49
-	private $transferService;
50
-
51
-	/** @var ILogger */
52
-	private $logger;
53
-
54
-	/** @var NotificationManager */
55
-	private $notificationManager;
56
-
57
-	/** @var TransferOwnershipMapper */
58
-	private $mapper;
59
-	/** @var IRootFolder */
60
-	private $rootFolder;
61
-
62
-	public function __construct(ITimeFactory $timeFactory,
63
-								IUserManager $userManager,
64
-								OwnershipTransferService $transferService,
65
-								ILogger $logger,
66
-								NotificationManager $notificationManager,
67
-								TransferOwnershipMapper $mapper,
68
-								IRootFolder $rootFolder) {
69
-		parent::__construct($timeFactory);
70
-
71
-		$this->userManager = $userManager;
72
-		$this->transferService = $transferService;
73
-		$this->logger = $logger;
74
-		$this->notificationManager = $notificationManager;
75
-		$this->mapper = $mapper;
76
-		$this->rootFolder = $rootFolder;
77
-	}
78
-
79
-	protected function run($argument) {
80
-		$id = $argument['id'];
81
-
82
-		$transfer = $this->mapper->getById($id);
83
-		$sourceUser = $transfer->getSourceUser();
84
-		$destinationUser = $transfer->getTargetUser();
85
-		$fileId = $transfer->getFileId();
86
-
87
-		$userFolder = $this->rootFolder->getUserFolder($sourceUser);
88
-		$nodes = $userFolder->getById($fileId);
89
-
90
-		if (empty($nodes)) {
91
-			$this->logger->alert('Could not transfer ownership: Node not found');
92
-			$this->failedNotication($transfer);
93
-			return;
94
-		}
95
-		$path = $userFolder->getRelativePath($nodes[0]->getPath());
96
-
97
-		$sourceUserObject = $this->userManager->get($sourceUser);
98
-		$destinationUserObject = $this->userManager->get($destinationUser);
99
-
100
-		if (!$sourceUserObject instanceof IUser) {
101
-			$this->logger->alert('Could not transfer ownership: Unknown source user ' . $sourceUser);
102
-			$this->failedNotication($transfer);
103
-			return;
104
-		}
105
-
106
-		if (!$destinationUserObject instanceof IUser) {
107
-			$this->logger->alert("Unknown destination user $destinationUser");
108
-			$this->failedNotication($transfer);
109
-			return;
110
-		}
111
-
112
-		try {
113
-			$this->transferService->transfer(
114
-				$sourceUserObject,
115
-				$destinationUserObject,
116
-				ltrim($path, '/')
117
-			);
118
-			$this->successNotification($transfer);
119
-		} catch (TransferOwnershipException $e) {
120
-			$this->logger->logException($e);
121
-			$this->failedNotication($transfer);
122
-		}
123
-
124
-		$this->mapper->delete($transfer);
125
-	}
126
-
127
-	private function failedNotication(Transfer $transfer): void {
128
-		// Send notification to source user
129
-		$notification = $this->notificationManager->createNotification();
130
-		$notification->setUser($transfer->getSourceUser())
131
-			->setApp(Application::APP_ID)
132
-			->setDateTime($this->time->getDateTime())
133
-			->setSubject('transferOwnershipFailedSource', [
134
-				'sourceUser' => $transfer->getSourceUser(),
135
-				'targetUser' => $transfer->getTargetUser(),
136
-				'nodeName' => $transfer->getNodeName(),
137
-			])
138
-			->setObject('transfer', (string)$transfer->getId());
139
-		$this->notificationManager->notify($notification);
140
-
141
-		// Send notification to source user
142
-		$notification = $this->notificationManager->createNotification();
143
-		$notification->setUser($transfer->getTargetUser())
144
-			->setApp(Application::APP_ID)
145
-			->setDateTime($this->time->getDateTime())
146
-			->setSubject('transferOwnershipFailedTarget', [
147
-				'sourceUser' => $transfer->getSourceUser(),
148
-				'targetUser' => $transfer->getTargetUser(),
149
-				'nodeName' => $transfer->getNodeName(),
150
-			])
151
-			->setObject('transfer', (string)$transfer->getId());
152
-		$this->notificationManager->notify($notification);
153
-	}
154
-
155
-	private function successNotification(Transfer $transfer): void {
156
-		// Send notification to source user
157
-		$notification = $this->notificationManager->createNotification();
158
-		$notification->setUser($transfer->getSourceUser())
159
-			->setApp(Application::APP_ID)
160
-			->setDateTime($this->time->getDateTime())
161
-			->setSubject('transferOwnershipDoneSource', [
162
-				'sourceUser' => $transfer->getSourceUser(),
163
-				'targetUser' => $transfer->getTargetUser(),
164
-				'nodeName' => $transfer->getNodeName(),
165
-			])
166
-			->setObject('transfer', (string)$transfer->getId());
167
-		$this->notificationManager->notify($notification);
168
-
169
-		// Send notification to source user
170
-		$notification = $this->notificationManager->createNotification();
171
-		$notification->setUser($transfer->getTargetUser())
172
-			->setApp(Application::APP_ID)
173
-			->setDateTime($this->time->getDateTime())
174
-			->setSubject('transferOwnershipDoneTarget', [
175
-				'sourceUser' => $transfer->getSourceUser(),
176
-				'targetUser' => $transfer->getTargetUser(),
177
-				'nodeName' => $transfer->getNodeName(),
178
-			])
179
-			->setObject('transfer', (string)$transfer->getId());
180
-		$this->notificationManager->notify($notification);
181
-	}
45
+    /** @var IUserManager $userManager */
46
+    private $userManager;
47
+
48
+    /** @var OwnershipTransferService */
49
+    private $transferService;
50
+
51
+    /** @var ILogger */
52
+    private $logger;
53
+
54
+    /** @var NotificationManager */
55
+    private $notificationManager;
56
+
57
+    /** @var TransferOwnershipMapper */
58
+    private $mapper;
59
+    /** @var IRootFolder */
60
+    private $rootFolder;
61
+
62
+    public function __construct(ITimeFactory $timeFactory,
63
+                                IUserManager $userManager,
64
+                                OwnershipTransferService $transferService,
65
+                                ILogger $logger,
66
+                                NotificationManager $notificationManager,
67
+                                TransferOwnershipMapper $mapper,
68
+                                IRootFolder $rootFolder) {
69
+        parent::__construct($timeFactory);
70
+
71
+        $this->userManager = $userManager;
72
+        $this->transferService = $transferService;
73
+        $this->logger = $logger;
74
+        $this->notificationManager = $notificationManager;
75
+        $this->mapper = $mapper;
76
+        $this->rootFolder = $rootFolder;
77
+    }
78
+
79
+    protected function run($argument) {
80
+        $id = $argument['id'];
81
+
82
+        $transfer = $this->mapper->getById($id);
83
+        $sourceUser = $transfer->getSourceUser();
84
+        $destinationUser = $transfer->getTargetUser();
85
+        $fileId = $transfer->getFileId();
86
+
87
+        $userFolder = $this->rootFolder->getUserFolder($sourceUser);
88
+        $nodes = $userFolder->getById($fileId);
89
+
90
+        if (empty($nodes)) {
91
+            $this->logger->alert('Could not transfer ownership: Node not found');
92
+            $this->failedNotication($transfer);
93
+            return;
94
+        }
95
+        $path = $userFolder->getRelativePath($nodes[0]->getPath());
96
+
97
+        $sourceUserObject = $this->userManager->get($sourceUser);
98
+        $destinationUserObject = $this->userManager->get($destinationUser);
99
+
100
+        if (!$sourceUserObject instanceof IUser) {
101
+            $this->logger->alert('Could not transfer ownership: Unknown source user ' . $sourceUser);
102
+            $this->failedNotication($transfer);
103
+            return;
104
+        }
105
+
106
+        if (!$destinationUserObject instanceof IUser) {
107
+            $this->logger->alert("Unknown destination user $destinationUser");
108
+            $this->failedNotication($transfer);
109
+            return;
110
+        }
111
+
112
+        try {
113
+            $this->transferService->transfer(
114
+                $sourceUserObject,
115
+                $destinationUserObject,
116
+                ltrim($path, '/')
117
+            );
118
+            $this->successNotification($transfer);
119
+        } catch (TransferOwnershipException $e) {
120
+            $this->logger->logException($e);
121
+            $this->failedNotication($transfer);
122
+        }
123
+
124
+        $this->mapper->delete($transfer);
125
+    }
126
+
127
+    private function failedNotication(Transfer $transfer): void {
128
+        // Send notification to source user
129
+        $notification = $this->notificationManager->createNotification();
130
+        $notification->setUser($transfer->getSourceUser())
131
+            ->setApp(Application::APP_ID)
132
+            ->setDateTime($this->time->getDateTime())
133
+            ->setSubject('transferOwnershipFailedSource', [
134
+                'sourceUser' => $transfer->getSourceUser(),
135
+                'targetUser' => $transfer->getTargetUser(),
136
+                'nodeName' => $transfer->getNodeName(),
137
+            ])
138
+            ->setObject('transfer', (string)$transfer->getId());
139
+        $this->notificationManager->notify($notification);
140
+
141
+        // Send notification to source user
142
+        $notification = $this->notificationManager->createNotification();
143
+        $notification->setUser($transfer->getTargetUser())
144
+            ->setApp(Application::APP_ID)
145
+            ->setDateTime($this->time->getDateTime())
146
+            ->setSubject('transferOwnershipFailedTarget', [
147
+                'sourceUser' => $transfer->getSourceUser(),
148
+                'targetUser' => $transfer->getTargetUser(),
149
+                'nodeName' => $transfer->getNodeName(),
150
+            ])
151
+            ->setObject('transfer', (string)$transfer->getId());
152
+        $this->notificationManager->notify($notification);
153
+    }
154
+
155
+    private function successNotification(Transfer $transfer): void {
156
+        // Send notification to source user
157
+        $notification = $this->notificationManager->createNotification();
158
+        $notification->setUser($transfer->getSourceUser())
159
+            ->setApp(Application::APP_ID)
160
+            ->setDateTime($this->time->getDateTime())
161
+            ->setSubject('transferOwnershipDoneSource', [
162
+                'sourceUser' => $transfer->getSourceUser(),
163
+                'targetUser' => $transfer->getTargetUser(),
164
+                'nodeName' => $transfer->getNodeName(),
165
+            ])
166
+            ->setObject('transfer', (string)$transfer->getId());
167
+        $this->notificationManager->notify($notification);
168
+
169
+        // Send notification to source user
170
+        $notification = $this->notificationManager->createNotification();
171
+        $notification->setUser($transfer->getTargetUser())
172
+            ->setApp(Application::APP_ID)
173
+            ->setDateTime($this->time->getDateTime())
174
+            ->setSubject('transferOwnershipDoneTarget', [
175
+                'sourceUser' => $transfer->getSourceUser(),
176
+                'targetUser' => $transfer->getTargetUser(),
177
+                'nodeName' => $transfer->getNodeName(),
178
+            ])
179
+            ->setObject('transfer', (string)$transfer->getId());
180
+        $this->notificationManager->notify($notification);
181
+    }
182 182
 }
Please login to merge, or discard this patch.