fixes and organizing models
Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
Родитель
f1ad6f9ae6
Коммит
a419f4abd7
|
@ -26,9 +26,9 @@ namespace OCA\Polls\Command\Share;
|
|||
use OC\Core\Command\Base;
|
||||
use OCA\Polls\Db\Poll;
|
||||
use OCA\Polls\Exceptions\ShareAlreadyExistsException;
|
||||
use OCA\Polls\Model\Email;
|
||||
use OCA\Polls\Model\Group;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\UserGroup\Email;
|
||||
use OCA\Polls\Model\UserGroup\Group;
|
||||
use OCA\Polls\Model\UserGroup\User;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
|
|
@ -26,11 +26,11 @@ namespace OCA\Polls\Command\Share;
|
|||
use OC\Core\Command\Base;
|
||||
use OCA\Polls\Db\Poll;
|
||||
use OCA\Polls\Db\Share;
|
||||
use OCA\Polls\Model\Contact;
|
||||
use OCA\Polls\Model\Email;
|
||||
use OCA\Polls\Model\GenericUser;
|
||||
use OCA\Polls\Model\Group;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\UserGroup\Contact;
|
||||
use OCA\Polls\Model\UserGroup\Email;
|
||||
use OCA\Polls\Model\UserGroup\GenericUser;
|
||||
use OCA\Polls\Model\UserGroup\Group;
|
||||
use OCA\Polls\Model\UserGroup\User;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
|
|
@ -31,7 +31,7 @@ use OCA\Polls\Db\Poll;
|
|||
use OCA\Polls\Service\PollService;
|
||||
use OCA\Polls\Service\OptionService;
|
||||
use OCA\Polls\Model\Acl;
|
||||
use OCA\Polls\Model\AppSettings;
|
||||
use OCA\Polls\Model\Settings\AppSettings;
|
||||
|
||||
class PollController extends Controller {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ use OCA\Polls\Db\Share;
|
|||
use OCA\Polls\Service\MailService;
|
||||
use OCA\Polls\Service\ShareService;
|
||||
use OCA\Polls\Service\SystemService;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
|
||||
class ShareController extends Controller {
|
||||
use ResponseHandle;
|
||||
|
@ -168,7 +168,7 @@ class ShareController extends Controller {
|
|||
throw new InvalidShareTypeException('Cannot resolve members from share type ' . $share->getType());
|
||||
}
|
||||
|
||||
foreach (UserGroupClass::getUserGroupChild($share->getType(), $share->getUserId())->getMembers() as $member) {
|
||||
foreach (UserBase::getUserGroupChild($share->getType(), $share->getUserId())->getMembers() as $member) {
|
||||
try {
|
||||
$newShare = $this->shareService->add($share->getPollId(), $member->getType(), $member->getId());
|
||||
$shares[] = $newShare;
|
||||
|
|
|
@ -28,7 +28,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
|
|||
use OCA\Polls\Db\LogMapper;
|
||||
use OCA\Polls\Db\PollMapper;
|
||||
use OCA\Polls\Db\WatchMapper;
|
||||
use OCA\Polls\Model\AppSettings;
|
||||
use OCA\Polls\Model\Settings\AppSettings;
|
||||
|
||||
class JanitorCron extends TimedJob {
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ use JsonSerializable;
|
|||
|
||||
use OCP\IUser;
|
||||
use OCP\AppFramework\Db\Entity;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\UserGroup\User;
|
||||
|
||||
/**
|
||||
* @method string getType()
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace OCA\Polls\Db;
|
|||
use JsonSerializable;
|
||||
|
||||
use OCP\AppFramework\Db\Entity;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\AppSettings;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
use OCA\Polls\Model\Settings\AppSettings;
|
||||
|
||||
/**
|
||||
* @method int getId()
|
||||
|
@ -147,8 +147,8 @@ class Share extends Entity implements JsonSerializable {
|
|||
return $this->userId;
|
||||
}
|
||||
|
||||
public function getUserObject(): UserGroupClass {
|
||||
return UserGroupClass::getUserGroupChild(
|
||||
public function getUserObject(): UserBase {
|
||||
return UserBase::getUserGroupChild(
|
||||
$this->type,
|
||||
$this->userId,
|
||||
$this->displayName,
|
||||
|
@ -157,16 +157,16 @@ class Share extends Entity implements JsonSerializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return UserGroupClass[]
|
||||
* @return UserBase[]
|
||||
*/
|
||||
public function getMembers() {
|
||||
if ($this->type === self::TYPE_GROUP
|
||||
|| $this->type === self::TYPE_CONTACTGROUP
|
||||
|| $this->type === self::TYPE_CIRCLE) {
|
||||
$group = UserGroupClass::getUserGroupChild($this->type, $this->getUserId());
|
||||
$group = UserBase::getUserGroupChild($this->type, $this->getUserId());
|
||||
return $group->getMembers();
|
||||
} else {
|
||||
return [UserGroupClass::getUserGroupChild(
|
||||
return [UserBase::getUserGroupChild(
|
||||
$this->type,
|
||||
$this->userId,
|
||||
$this->displayName,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2020 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -25,16 +25,16 @@
|
|||
namespace OCA\Polls\Model;
|
||||
|
||||
use JsonSerializable;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
use OCA\Polls\Exceptions\NotAuthorizedException;
|
||||
|
||||
use OCP\IUserManager;
|
||||
use OCP\IGroupManager;
|
||||
use OCA\Polls\Model\Settings\AppSettings;
|
||||
use OCA\Polls\Db\Poll;
|
||||
use OCA\Polls\Db\Share;
|
||||
use OCA\Polls\Db\PollMapper;
|
||||
use OCA\Polls\Db\VoteMapper;
|
||||
use OCA\Polls\Db\ShareMapper;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
|
||||
/**
|
||||
* Class Acl
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2020 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
|
|
@ -26,12 +26,10 @@ namespace OCA\Polls\Model\Mail;
|
|||
|
||||
use OCP\Mail\IEMailTemplate;
|
||||
|
||||
Interface IMail {
|
||||
|
||||
interface IMail {
|
||||
public function getEmailTemplate() : IEMailTemplate;
|
||||
|
||||
public function buildEmailTemplate() : void;
|
||||
|
||||
public function send(): void;
|
||||
|
||||
}
|
||||
|
|
|
@ -25,21 +25,14 @@
|
|||
namespace OCA\Polls\Model\Mail;
|
||||
|
||||
use OCA\Polls\Db\Poll;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\Mail\IMail;
|
||||
use OCP\IL10N;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Mail\IEMailTemplate;
|
||||
use OCP\Mail\IMailer;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
|
||||
class InvitationMail extends Mail implements IMail {
|
||||
class InvitationMail extends MailBase implements IMail {
|
||||
private const TEMPLATE_CLASS = 'polls.Invitation';
|
||||
|
||||
public function __construct(
|
||||
UserGroupClass $recipient,
|
||||
UserBase $recipient,
|
||||
Poll $poll,
|
||||
string $url
|
||||
) {
|
||||
|
|
|
@ -25,20 +25,18 @@
|
|||
namespace OCA\Polls\Model\Mail;
|
||||
|
||||
use OCA\Polls\AppInfo\Application;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
use OCA\Polls\Model\UserGroup\User;
|
||||
use OCA\Polls\Db\Poll;
|
||||
use OCP\IL10N;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Mail\IEMailTemplate;
|
||||
use OCP\Mail\IMailer;
|
||||
|
||||
|
||||
class Mail{
|
||||
class MailBase {
|
||||
private const TEMPLATE_CLASS = 'polls.Mail';
|
||||
|
||||
/** @var UserGroupClass */
|
||||
/** @var UserBase */
|
||||
protected $recipient;
|
||||
|
||||
/** @var Poll */
|
||||
|
@ -63,7 +61,7 @@ class Mail{
|
|||
protected $owner;
|
||||
|
||||
public function __construct(
|
||||
UserGroupClass $recipient,
|
||||
UserBase $recipient,
|
||||
Poll $poll,
|
||||
string $url
|
||||
) {
|
||||
|
@ -115,5 +113,4 @@ class Mail{
|
|||
$app = \OC::$server->query(Application::class);
|
||||
return $app->getContainer();
|
||||
}
|
||||
|
||||
}
|
|
@ -26,18 +26,10 @@ namespace OCA\Polls\Model\Mail;
|
|||
|
||||
use OCA\Polls\Db\Poll;
|
||||
use OCA\Polls\Db\ShareMapper;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\Mail\IMail;
|
||||
use OCP\IL10N;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
use OCP\IUserManager;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Mail\IEMailTemplate;
|
||||
use OCP\Mail\IMailer;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
|
||||
class InvitationMail extends Mail implements IMail {
|
||||
class NotificationMail extends MailBase implements IMail {
|
||||
private const TEMPLATE_CLASS = 'polls.Notification';
|
||||
|
||||
/** @var array */
|
||||
|
@ -50,7 +42,7 @@ class InvitationMail extends Mail implements IMail {
|
|||
protected $shareMapper;
|
||||
|
||||
public function __construct(
|
||||
UserGroupClass $recipient,
|
||||
UserBase $recipient,
|
||||
Poll $poll,
|
||||
string $url,
|
||||
array $logEntries
|
||||
|
@ -76,7 +68,7 @@ class InvitationMail extends Mail implements IMail {
|
|||
$this->emailTemplate->addBodyListItem($logItem);
|
||||
}
|
||||
|
||||
$this->emailTemplate->addBodyButton(htmlspecialchars($this->trans->t('Go to poll')), $url, '');
|
||||
$this->emailTemplate->addBodyButton(htmlspecialchars($this->trans->t('Go to poll')), $this->url, '');
|
||||
$this->emailTemplate->addFooter($this->trans->t('This email is sent to you, because you subscribed to notifications of this poll. To opt out, visit the poll and remove your subscription.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,16 +25,9 @@
|
|||
namespace OCA\Polls\Model\Mail;
|
||||
|
||||
use OCA\Polls\Db\Poll;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\Mail\IMail;
|
||||
use OCP\IL10N;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Mail\IEMailTemplate;
|
||||
use OCP\Mail\IMailer;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
|
||||
class ReminderMail extends Mail implements IMail {
|
||||
class ReminderMail extends MailBase implements IMail {
|
||||
private const TEMPLATE_CLASS = 'polls.Reminder';
|
||||
public const REASON_EXPIRATION = 'expiry';
|
||||
public const REASON_OPTION = 'option';
|
||||
|
@ -49,7 +42,7 @@ class ReminderMail extends Mail implements IMail {
|
|||
protected $remainingPeriodLess;
|
||||
|
||||
public function __construct(
|
||||
UserGroupClass $recipient,
|
||||
UserBase $recipient,
|
||||
Poll $poll,
|
||||
string $url,
|
||||
string $reason,
|
||||
|
|
|
@ -21,13 +21,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\Settings;
|
||||
|
||||
use JsonSerializable;
|
||||
use OCP\IConfig;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IUserSession;
|
||||
use OCA\Polls\AppInfo\Application;
|
||||
use OCA\Polls\Model\UserGroup\Group;
|
||||
|
||||
class AppSettings implements JsonSerializable {
|
||||
private const APP_NAME = 'polls';
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -21,7 +21,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
class Admin extends User {
|
||||
public const TYPE = 'admin';
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -21,15 +21,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
use OCP\App\IAppManager;
|
||||
use OCA\Circles\Api\v1\Circles;
|
||||
use OCA\Circles\Model\Circle as CirclesCircle;
|
||||
use OCA\Polls\Exceptions\CirclesNotEnabledException;
|
||||
|
||||
class Circle extends UserGroupClass {
|
||||
class Circle extends UserBase {
|
||||
public const TYPE = 'circle';
|
||||
public const ICON = 'icon-circles';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -21,14 +21,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\Contacts\IManager as IContactsManager;
|
||||
use OCA\Polls\Exceptions\MultipleContactsFound;
|
||||
use OCA\Polls\Exceptions\ContactsNotEnabledExceptions;
|
||||
|
||||
class Contact extends UserGroupClass {
|
||||
class Contact extends UserBase {
|
||||
public const TYPE = 'contact';
|
||||
public const ICON = 'icon-mail';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -21,14 +21,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\Contacts\IManager as IContactsManager;
|
||||
use OCA\Polls\Exceptions\ContactsNotEnabledExceptions;
|
||||
|
||||
class ContactGroup extends UserGroupClass {
|
||||
class ContactGroup extends UserBase {
|
||||
public const TYPE = 'contactGroup';
|
||||
public const ICON = 'icon-group';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
class Email extends UserGroupClass {
|
||||
class Email extends UserBase {
|
||||
public const TYPE = 'email';
|
||||
public const ICON = 'icon-mail';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -22,9 +22,9 @@
|
|||
*/
|
||||
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
class GenericUser extends UserGroupClass {
|
||||
class GenericUser extends UserBase {
|
||||
public const TYPE = 'external';
|
||||
public const ICON_DEFAULT = 'icon-share';
|
||||
public const ICON_PUBLIC = 'icon-public';
|
||||
|
@ -39,7 +39,7 @@ class GenericUser extends UserGroupClass {
|
|||
$this->displayName = $displayName;
|
||||
$this->emailAddress = $emailAddress;
|
||||
|
||||
if ($type === UserGroupClass::TYPE_PUBLIC) {
|
||||
if ($type === UserBase::TYPE_PUBLIC) {
|
||||
$this->icon = self::ICON_PUBLIC;
|
||||
$this->description = \OC::$server->getL10N('polls')->t('Public link');
|
||||
} else {
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -21,13 +21,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IGroup;
|
||||
|
||||
class Group extends UserGroupClass {
|
||||
class Group extends UserBase {
|
||||
public const TYPE = 'group';
|
||||
public const ICON = 'icon-group';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -21,12 +21,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUser;
|
||||
|
||||
class User extends UserGroupClass {
|
||||
class User extends UserBase {
|
||||
public const TYPE = 'user';
|
||||
public const ICON = 'icon-user';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
||||
* @copyright Copyright (c) 2021 René Gieling <github@dartcafe.de>
|
||||
*
|
||||
* @author René Gieling <github@dartcafe.de>
|
||||
*
|
||||
|
@ -21,7 +21,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Polls\Model;
|
||||
namespace OCA\Polls\Model\UserGroup;
|
||||
|
||||
use OCA\Polls\Exceptions\InvalidShareTypeException;
|
||||
|
||||
|
@ -30,7 +30,7 @@ use OCP\Collaboration\Collaborators\ISearch;
|
|||
use OCP\Share\IShare;
|
||||
use OCA\Polls\AppInfo\Application;
|
||||
|
||||
class UserGroupClass implements \JsonSerializable {
|
||||
class UserBase implements \JsonSerializable {
|
||||
public const TYPE = 'generic';
|
||||
public const TYPE_PUBLIC = 'public';
|
||||
public const TYPE_EXTERNAL = 'external';
|
|
@ -41,18 +41,17 @@ use OCA\Polls\Db\ShareMapper;
|
|||
use OCA\Polls\Db\Share;
|
||||
use OCA\Polls\Db\LogMapper;
|
||||
use OCA\Polls\Db\Log;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
use OCA\Polls\Model\UserGroup\User;
|
||||
use OCA\Polls\Model\Mail\InvitationMail;
|
||||
use OCA\Polls\Model\Mail\ReminderMail;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
|
||||
class MailService {
|
||||
private const FIVE_DAYS=432000;
|
||||
private const FOUR_DAYS=345600;
|
||||
private const THREE_DAYS=259200;
|
||||
private const TWO_DAYS=172800;
|
||||
private const ONE_AND_HALF_DAYS=129600;
|
||||
private const FIVE_DAYS = 432000;
|
||||
private const FOUR_DAYS = 345600;
|
||||
private const THREE_DAYS = 259200;
|
||||
private const TWO_DAYS = 172800;
|
||||
private const ONE_AND_HALF_DAYS = 129600;
|
||||
|
||||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
|
@ -264,7 +263,6 @@ class MailService {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function remindShares(Poll $poll, string $reminderReason, int $deadline, int $period):void {
|
||||
|
@ -277,7 +275,6 @@ class MailService {
|
|||
} catch (\Exception $e) {
|
||||
// catch silently
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$share->setReminderSent(time());
|
||||
|
@ -346,7 +343,7 @@ class MailService {
|
|||
return $logStrings[$logItem->getMessageId()] ?? $logItem->getMessageId() . " (" . $displayName . ")";
|
||||
}
|
||||
|
||||
private function generateNotification(UserGroupClass $recipient, Poll $poll, string $url, array $log): IEMailTemplate {
|
||||
private function generateNotification(UserBase $recipient, Poll $poll, string $url, array $log): IEMailTemplate {
|
||||
$owner = $poll->getOwnerUserObject();
|
||||
$this->trans = $this->transFactory->get('polls', $recipient->getLanguage() ? $recipient->getLanguage() : $owner->getLanguage());
|
||||
$emailTemplate = $this->mailer->createEMailTemplate('polls.Notification', [
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
namespace OCA\Polls\Service;
|
||||
|
||||
use OCP\IConfig;
|
||||
use OCA\Polls\Model\AppSettings;
|
||||
use OCA\Polls\Model\Group;
|
||||
use OCA\Polls\Model\Settings\AppSettings;
|
||||
use OCA\Polls\Model\UserGroup\Group;
|
||||
use OCA\Polls\AppInfo\Application;
|
||||
|
||||
class SettingsService {
|
||||
|
|
|
@ -40,7 +40,7 @@ use OCA\Polls\Db\ShareMapper;
|
|||
use OCA\Polls\Db\Share;
|
||||
use OCA\Polls\Event\ShareEvent;
|
||||
use OCA\Polls\Model\Acl;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
|
||||
class ShareService {
|
||||
|
||||
|
@ -191,7 +191,7 @@ class ShareService {
|
|||
// Return the created share
|
||||
return $this->create(
|
||||
$this->share->getPollId(),
|
||||
UserGroupClass::getUserGroupChild(Share::TYPE_USER, \OC::$server->getUserSession()->getUser()->getUID()),
|
||||
UserBase::getUserGroupChild(Share::TYPE_USER, \OC::$server->getUserSession()->getUser()->getUID()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ class ShareService {
|
|||
*
|
||||
* @return Share
|
||||
*/
|
||||
private function create(int $pollId, UserGroupClass $userGroup, bool $preventInvitation = false): Share {
|
||||
$preventInvitation = $userGroup->getType() === UserGroupClass::TYPE_PUBLIC ?: $preventInvitation;
|
||||
private function create(int $pollId, UserBase $userGroup, bool $preventInvitation = false): Share {
|
||||
$preventInvitation = $userGroup->getType() === UserBase::TYPE_PUBLIC ?: $preventInvitation;
|
||||
$token = \OC::$server->getSecureRandom()->generate(
|
||||
16,
|
||||
ISecureRandom::CHAR_DIGITS .
|
||||
|
@ -229,12 +229,12 @@ class ShareService {
|
|||
$this->share->setPollId($pollId);
|
||||
|
||||
// Convert user type contact to share type email
|
||||
if ($userGroup->getType() === UserGroupClass::TYPE_CONTACT) {
|
||||
if ($userGroup->getType() === UserBase::TYPE_CONTACT) {
|
||||
$this->share->setType(Share::TYPE_EMAIL);
|
||||
$this->share->setUserId($userGroup->getEmailAddress());
|
||||
} else {
|
||||
$this->share->setType($userGroup->getType());
|
||||
$this->share->setUserId($userGroup->getType() === UserGroupClass::TYPE_PUBLIC ? $token : $userGroup->getPublicId());
|
||||
$this->share->setUserId($userGroup->getType() === UserBase::TYPE_PUBLIC ? $token : $userGroup->getPublicId());
|
||||
}
|
||||
|
||||
$this->share->setInvitationSent($preventInvitation ? time() : 0);
|
||||
|
@ -256,7 +256,7 @@ class ShareService {
|
|||
public function add(int $pollId, string $type, string $userId = ''): Share {
|
||||
$this->acl->setPollId($pollId, Acl::PERMISSION_POLL_EDIT);
|
||||
|
||||
if ($type === UserGroupClass::TYPE_PUBLIC) {
|
||||
if ($type === UserBase::TYPE_PUBLIC) {
|
||||
$this->acl->request(ACL::PERMISSION_PUBLIC_SHARES);
|
||||
} else {
|
||||
try {
|
||||
|
@ -269,7 +269,7 @@ class ShareService {
|
|||
}
|
||||
}
|
||||
|
||||
$this->create($pollId, UserGroupClass::getUserGroupChild($type, $userId));
|
||||
$this->create($pollId, UserBase::getUserGroupChild($type, $userId));
|
||||
|
||||
return $this->share;
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ class ShareService {
|
|||
// prevent invtation sending, when no email address is given
|
||||
$this->create(
|
||||
$this->share->getPollId(),
|
||||
UserGroupClass::getUserGroupChild(Share::TYPE_EXTERNAL, $userName, $userName, $emailAddress),
|
||||
UserBase::getUserGroupChild(Share::TYPE_EXTERNAL, $userName, $userName, $emailAddress),
|
||||
!$emailAddress
|
||||
);
|
||||
} elseif ($this->share->getType() === Share::TYPE_EMAIL
|
||||
|
|
|
@ -29,13 +29,13 @@ use OCA\Polls\Exceptions\InvalidEmailAddress;
|
|||
|
||||
use OCA\Polls\Db\ShareMapper;
|
||||
use OCA\Polls\Db\VoteMapper;
|
||||
use OCA\Polls\Model\Circle;
|
||||
use OCA\Polls\Model\Contact;
|
||||
use OCA\Polls\Model\ContactGroup;
|
||||
use OCA\Polls\Model\Email;
|
||||
use OCA\Polls\Model\Group;
|
||||
use OCA\Polls\Model\User;
|
||||
use OCA\Polls\Model\UserGroupClass;
|
||||
use OCA\Polls\Model\UserGroup\Circle;
|
||||
use OCA\Polls\Model\UserGroup\Contact;
|
||||
use OCA\Polls\Model\UserGroup\ContactGroup;
|
||||
use OCA\Polls\Model\UserGroup\Email;
|
||||
use OCA\Polls\Model\UserGroup\Group;
|
||||
use OCA\Polls\Model\UserGroup\User;
|
||||
use OCA\Polls\Model\UserGroup\UserBase;
|
||||
|
||||
class SystemService {
|
||||
|
||||
|
@ -119,7 +119,7 @@ class SystemService {
|
|||
$list[] = new Email($query);
|
||||
}
|
||||
|
||||
$list = array_merge($list, UserGroupClass::search($query));
|
||||
$list = array_merge($list, UserBase::search($query));
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<ConfigBox :title="t('polls', 'Poll closing status')" :icon-class="closed ? 'icon-polls-closed' : 'icon-polls-open'">
|
||||
<ConfigClosing @change="writePoll" />
|
||||
<ConfigAutoReminder v-if="poll.type === 'datePoll' || poll.expire"
|
||||
@change="writePoll" />
|
||||
@change="writePoll" />
|
||||
</ConfigBox>
|
||||
|
||||
<ConfigBox v-if="acl.isOwner || acl.allowAllAccess" :title="t('polls', 'Access')" icon-class="icon-category-auth">
|
||||
|
|
Загрузка…
Ссылка в новой задаче