diff options
Diffstat (limited to 'lib/private/Federation/CloudId.php')
-rw-r--r-- | lib/private/Federation/CloudId.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/Federation/CloudId.php b/lib/private/Federation/CloudId.php index 80e174589b0..c917a9d5816 100644 --- a/lib/private/Federation/CloudId.php +++ b/lib/private/Federation/CloudId.php @@ -36,6 +36,8 @@ class CloudId implements ICloudId { private $user; /** @var string */ private $remote; + /** @var string|null */ + private $displayName; /** * CloudId constructor. @@ -44,10 +46,11 @@ class CloudId implements ICloudId { * @param string $user * @param string $remote */ - public function __construct(string $id, string $user, string $remote) { + public function __construct(string $id, string $user, string $remote, ?string $displayName = null) { $this->id = $id; $this->user = $user; $this->remote = $remote; + $this->displayName = $displayName; } /** @@ -60,6 +63,11 @@ class CloudId implements ICloudId { } public function getDisplayId(): string { + if ($this->displayName) { + $atPos = strrpos($this->getId(), '@'); + $atHost = substr($this->getId(), $atPos); + return $this->displayName . $atHost; + } return str_replace('https://', '', str_replace('http://', '', $this->getId())); } |