diff options
author | dartcafe <github@dartcafe.de> | 2022-02-15 01:56:54 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2022-02-15 01:56:54 +0300 |
commit | 041b0a2233d8a8e781dd5ed2f9b246bd37deba39 (patch) | |
tree | ea6d611cb38015c6f9de5322997f97a3cc0e62e9 /lib | |
parent | c614c24fdfa1cc82fef716ff6f6176950838a8dc (diff) |
return email address in user search for users and contacts resolve #2264
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Model/UserGroup/Contact.php | 16 | ||||
-rw-r--r-- | lib/Model/UserGroup/User.php | 8 |
2 files changed, 20 insertions, 4 deletions
diff --git a/lib/Model/UserGroup/Contact.php b/lib/Model/UserGroup/Contact.php index dbc6a283..6c7d52e2 100644 --- a/lib/Model/UserGroup/Contact.php +++ b/lib/Model/UserGroup/Contact.php @@ -107,14 +107,24 @@ class Contact extends UserBase { $this->emailAddress = $this->contact['EMAIL'][0] ?? $this->emailAddress; $this->organisation = $this->contact['ORG'] ?? ''; $this->categories = isset($this->contact['CATEGORIES']) ? explode(',', $this->contact['CATEGORIES']) : []; - $description = $this->categories; + } + + public function getDescription(): string { + $description = $this->getCategories(); if (isset($this->contact['ORG'])) { - array_unshift($description, $this->organisation); + array_unshift($description, $this->getOrganisation()); + } + + if ($this->getEmailAddress()) { + array_unshift($description, $this->getEmailAddress()); } - $this->description = count($description) ? implode(", ", $description) : Container::getL10N()->t('Contact'); + + return count($description) ? implode(", ", $description) : Container::getL10N()->t('Contact'); } + + public static function isEnabled(): bool { return Container::isAppEnabled('contacts'); } diff --git a/lib/Model/UserGroup/User.php b/lib/Model/UserGroup/User.php index 9973fa68..522b5619 100644 --- a/lib/Model/UserGroup/User.php +++ b/lib/Model/UserGroup/User.php @@ -45,8 +45,8 @@ class User extends UserBase { ) { parent::__construct($id, $type); $this->icon = self::ICON; - $this->description = Container::getL10N()->t('User'); $this->isNoUser = false; + $this->description = Container::getL10N()->t('User'); $this->config = Container::queryClass(IConfig::class); $this->user = Container::queryClass(IUserManager::class)->get($this->id); @@ -68,6 +68,12 @@ class User extends UserBase { return new DateTimeZone($this->timezone->getTimeZone()->getName()); } + public function getDescription(): string { + if ($this->getEmailAddress()) { + return $this->getEmailAddress(); + } + return $this->description; + } /** * @return User[] |