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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-07-30 22:10:54 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-07-30 22:10:54 +0300
commitb79e34c57ba74246a03a66045a6b792e35da1d32 (patch)
tree8b00bf3c8ae42109cadb7a82d1ed936243791916 /apps/federatedfilesharing/lib
parent2698e9e0113840ab7fb9e98d43a5cb40c58518ff (diff)
fix check for Cloud ID, missing return statements, wrong param use
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/federatedfilesharing/lib')
-rw-r--r--apps/federatedfilesharing/lib/Notifier.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/apps/federatedfilesharing/lib/Notifier.php b/apps/federatedfilesharing/lib/Notifier.php
index 46081240d6a..cae3fc2aa99 100644
--- a/apps/federatedfilesharing/lib/Notifier.php
+++ b/apps/federatedfilesharing/lib/Notifier.php
@@ -107,9 +107,7 @@ class Notifier implements INotifier {
);
$initiator = $params[0];
- $initiatorDisplay = isset($params[3]) ? $params[3] : null;
$owner = $params[1];
- $ownerDisplay = isset($params[4]) ? $params[4] : null;
$notification->setRichSubject(
$l->t('You received {share} as a remote share from {user} (on behalf of {behalf})'),
@@ -119,8 +117,8 @@ class Notifier implements INotifier {
'id' => $notification->getObjectId(),
'name' => $params[2],
],
- 'user' => $this->createRemoteUser($initiator, $initiatorDisplay),
- 'behalf' => $this->createRemoteUser($owner, $ownerDisplay),
+ 'user' => $this->createRemoteUser($initiator),
+ 'behalf' => $this->createRemoteUser($owner),
]
);
} else {
@@ -129,7 +127,6 @@ class Notifier implements INotifier {
);
$owner = $params[0];
- $ownerDisplay = isset($params[3]) ? $params[3] : null;
$notification->setRichSubject(
$l->t('You received {share} as a remote share from {user}'),
@@ -139,7 +136,7 @@ class Notifier implements INotifier {
'id' => $notification->getObjectId(),
'name' => $params[2],
],
- 'user' => $this->createRemoteUser($owner, $ownerDisplay),
+ 'user' => $this->createRemoteUser($owner),
]
);
}
@@ -203,7 +200,7 @@ class Notifier implements INotifier {
* @param ICloudId $cloudId
* @return string
*/
- protected function getDisplayName(ICloudId $cloudId) {
+ protected function getDisplayName(ICloudId $cloudId): string {
$server = $cloudId->getRemote();
$user = $cloudId->getUser();
if (strpos($server, 'http://') === 0) {
@@ -213,17 +210,24 @@ class Notifier implements INotifier {
}
try {
+ // contains protocol in the ID
return $this->getDisplayNameFromContact($cloudId->getId());
} catch (\OutOfBoundsException $e) {
}
try {
- $this->getDisplayNameFromContact($user . '@http://' . $server);
+ // does not include protocol, as stored in addressbooks
+ return $this->getDisplayNameFromContact($cloudId->getDisplayId());
} catch (\OutOfBoundsException $e) {
}
try {
- $this->getDisplayNameFromContact($user . '@https://' . $server);
+ return $this->getDisplayNameFromContact($user . '@http://' . $server);
+ } catch (\OutOfBoundsException $e) {
+ }
+
+ try {
+ return $this->getDisplayNameFromContact($user . '@https://' . $server);
} catch (\OutOfBoundsException $e) {
}