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

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2022-02-14 11:04:21 +0300
committerdartcafe <github@dartcafe.de>2022-02-14 11:04:21 +0300
commit99fe629823c88d53b9b82dc33779f0d017cfef2d (patch)
tree3bdaa078de61cc25566faf730bdf1350016f6a90
parentc017eb9e1979f4e0aa238b005468edca2437d2a9 (diff)
changed class loading and change error level to warning
Signed-off-by: dartcafe <github@dartcafe.de>
-rw-r--r--lib/Model/UserGroup/Circle.php7
-rw-r--r--lib/Model/UserGroup/Contact.php11
-rw-r--r--lib/Model/UserGroup/ContactGroup.php10
-rw-r--r--lib/Model/UserGroup/Email.php5
-rw-r--r--lib/Model/UserGroup/GenericUser.php11
-rw-r--r--lib/Model/UserGroup/Group.php5
-rw-r--r--lib/Model/UserGroup/User.php2
-rw-r--r--lib/Model/UserGroup/UserBase.php11
8 files changed, 34 insertions, 28 deletions
diff --git a/lib/Model/UserGroup/Circle.php b/lib/Model/UserGroup/Circle.php
index eaea704e..ee637ad5 100644
--- a/lib/Model/UserGroup/Circle.php
+++ b/lib/Model/UserGroup/Circle.php
@@ -39,12 +39,13 @@ class Circle extends UserBase {
string $id
) {
parent::__construct($id, self::TYPE);
+ $this->icon = self::ICON;
+ $this->description = Container::getL10N()->t('Circle');
+ $this->richObjectType = 'circle';
+
if (self::isEnabled()) {
- $this->icon = self::ICON;
$this->circle = Circles::detailsCircle($id);
$this->displayName = $this->circle->getName();
- $this->description = Container::getL10N()->t('Circle');
- $this->richObjectType = 'circle';
} else {
throw new CirclesNotEnabledException();
}
diff --git a/lib/Model/UserGroup/Contact.php b/lib/Model/UserGroup/Contact.php
index f5286b2a..dbc6a283 100644
--- a/lib/Model/UserGroup/Contact.php
+++ b/lib/Model/UserGroup/Contact.php
@@ -43,14 +43,17 @@ class Contact extends UserBase {
string $id
) {
parent::__construct($id, self::TYPE);
+ $this->icon = self::ICON;
+ $this->description = Container::getL10N()->t('Contact');
+ $this->richObjectType = 'addressbook-contact';
+
+ $this->logger = Container::queryClass(LoggerInterface::class);
+
if (self::isEnabled()) {
- $this->icon = self::ICON;
$this->getContact();
- $this->richObjectType = 'addressbook-contact';
} else {
throw new ContactsNotEnabledExceptions();
}
- $this->logger = Container::queryClass(LoggerInterface::class);
}
@@ -89,7 +92,7 @@ class Contact extends UserBase {
// Don't throw an error, log the error and take the first entry
if (count($contacts) > 1) {
// throw new MultipleContactsFound('Multiple contacts found for id ' . $this->id);
- $this->logger->error('Multiple contacts found for id ' . $this->id);
+ $this->logger->warning('Multiple contacts found for id ' . $this->id);
}
$this->contact = $contacts[0];
diff --git a/lib/Model/UserGroup/ContactGroup.php b/lib/Model/UserGroup/ContactGroup.php
index ecd6c64d..b884b4f4 100644
--- a/lib/Model/UserGroup/ContactGroup.php
+++ b/lib/Model/UserGroup/ContactGroup.php
@@ -35,11 +35,11 @@ class ContactGroup extends UserBase {
string $id
) {
parent::__construct($id, self::TYPE);
- if (self::isEnabled()) {
- $this->icon = self::ICON;
- $this->description = Container::getL10N()->t('Contact group');
- $this->richObjectType = 'addressbook-contact';
- } else {
+ $this->icon = self::ICON;
+ $this->description = Container::getL10N()->t('Contact group');
+ $this->richObjectType = 'addressbook-contact';
+
+ if (!self::isEnabled()) {
throw new ContactsNotEnabledExceptions();
}
}
diff --git a/lib/Model/UserGroup/Email.php b/lib/Model/UserGroup/Email.php
index 0fc379cc..510c1f2b 100644
--- a/lib/Model/UserGroup/Email.php
+++ b/lib/Model/UserGroup/Email.php
@@ -35,11 +35,12 @@ class Email extends UserBase {
string $displayName = ''
) {
parent::__construct($id, self::TYPE);
- $this->description = Container::getL10N()->t('External Email');
$this->icon = self::ICON;
+ $this->description = Container::getL10N()->t('External Email');
+ $this->richObjectType = 'email';
+
$this->emailAddress = $id;
$this->displayName = $displayName ? $displayName : $this->displayName;
- $this->richObjectType = 'email';
}
public function getDisplayName(): string {
diff --git a/lib/Model/UserGroup/GenericUser.php b/lib/Model/UserGroup/GenericUser.php
index 01adb4af..03ed9282 100644
--- a/lib/Model/UserGroup/GenericUser.php
+++ b/lib/Model/UserGroup/GenericUser.php
@@ -38,16 +38,17 @@ class GenericUser extends UserBase {
string $emailAddress = ''
) {
parent::__construct($id, $type);
- $this->displayName = $displayName;
- $this->emailAddress = $emailAddress;
+ $this->icon = self::ICON_DEFAULT;
+ $this->description = Container::getL10N()->t('External user');
$this->richObjectType = 'guest';
if ($type === UserBase::TYPE_PUBLIC) {
$this->icon = self::ICON_PUBLIC;
$this->description = Container::getL10N()->t('Public link');
- } else {
- $this->icon = self::ICON_DEFAULT;
- $this->description = Container::getL10N()->t('External user');
}
+
+ $this->displayName = $displayName;
+ $this->emailAddress = $emailAddress;
+
}
}
diff --git a/lib/Model/UserGroup/Group.php b/lib/Model/UserGroup/Group.php
index c2067517..0fe6f966 100644
--- a/lib/Model/UserGroup/Group.php
+++ b/lib/Model/UserGroup/Group.php
@@ -39,10 +39,11 @@ class Group extends UserBase {
) {
parent::__construct($id, self::TYPE);
$this->icon = self::ICON;
- $this->group = Container::queryClass(IGroupManager::class)->get($this->id);
$this->description = Container::getL10N()->t('Group');
- $this->displayName = $this->group->getDisplayName();
$this->richObjectType = 'user-group';
+
+ $this->group = Container::queryClass(IGroupManager::class)->get($this->id);
+ $this->displayName = $this->group->getDisplayName();
}
/**
diff --git a/lib/Model/UserGroup/User.php b/lib/Model/UserGroup/User.php
index a1b7a756..9973fa68 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->isNoUser = false;
$this->description = Container::getL10N()->t('User');
+ $this->isNoUser = false;
$this->config = Container::queryClass(IConfig::class);
$this->user = Container::queryClass(IUserManager::class)->get($this->id);
diff --git a/lib/Model/UserGroup/UserBase.php b/lib/Model/UserGroup/UserBase.php
index 94244649..928818fa 100644
--- a/lib/Model/UserGroup/UserBase.php
+++ b/lib/Model/UserGroup/UserBase.php
@@ -94,24 +94,23 @@ class UserBase implements \JsonSerializable {
string $language = '',
string $locale = ''
) {
+ $this->icon = 'icon-share';
+
+ $this->l10n = Container::getL10N();
+ $this->timezone = Container::queryClass(IDateTimeZone::class);
+
$this->id = $id;
$this->type = $type;
$this->displayName = $displayName;
$this->emailAddress = $emailAddress;
$this->language = $language;
$this->locale = $locale;
- $this->icon = 'icon-share';
- $this->l10n = Container::getL10N();
- $this->timezone = Container::queryClass(IDateTimeZone::class);
}
public function getId(): string {
return $this->id;
}
- /**
- * @return string
- */
public function getPublicId(): string {
return $this->id;
}