diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/PublicController.php | 4 | ||||
-rw-r--r-- | lib/Controller/SubscriptionApiController.php | 4 | ||||
-rw-r--r-- | lib/Controller/SubscriptionController.php | 4 | ||||
-rw-r--r-- | lib/Event/PollDeletedEvent.php | 2 | ||||
-rw-r--r-- | lib/Migration/CreateIndices.php | 21 | ||||
-rw-r--r-- | lib/Migration/RemoveIndices.php | 3 | ||||
-rw-r--r-- | lib/Migration/TableSchema.php | 6 | ||||
-rw-r--r-- | lib/Migration/Version030000Date20210704120000.php (renamed from lib/Migration/Version030000Date20210611120000.php) | 2 | ||||
-rw-r--r-- | lib/Model/Group.php | 8 | ||||
-rw-r--r-- | lib/Notification/Notifier.php | 4 | ||||
-rw-r--r-- | lib/Service/SubscriptionService.php | 2 |
11 files changed, 19 insertions, 41 deletions
diff --git a/lib/Controller/PublicController.php b/lib/Controller/PublicController.php index 5843d7a2..040f4eb1 100644 --- a/lib/Controller/PublicController.php +++ b/lib/Controller/PublicController.php @@ -293,7 +293,7 @@ class PublicController extends Controller { */ public function subscribe(string $token): DataResponse { return $this->response(function () use ($token) { - return ['subscribed' => $this->subscriptionService->set(0, $token, true)]; + return ['subscribed' => $this->subscriptionService->set(true, 0, $token)]; }); } @@ -304,7 +304,7 @@ class PublicController extends Controller { */ public function unsubscribe(string $token): DataResponse { return $this->response(function () use ($token) { - return ['subscribed' => $this->subscriptionService->set(0, $token, false)]; + return ['subscribed' => $this->subscriptionService->set(true, 0, $token)]; }); } diff --git a/lib/Controller/SubscriptionApiController.php b/lib/Controller/SubscriptionApiController.php index 7a63e88e..419d2228 100644 --- a/lib/Controller/SubscriptionApiController.php +++ b/lib/Controller/SubscriptionApiController.php @@ -78,7 +78,7 @@ class SubscriptionApiController extends ApiController { */ public function subscribe(int $pollId): DataResponse { try { - $this->subscriptionService->set($pollId, '', true); + $this->subscriptionService->set(true, $pollId, ''); return new DataResponse(['status' => 'Subscribed to poll ' . $pollId], Http::STATUS_OK); } catch (Exception $e) { return new DataResponse(['message' => $e->getMessage()], $e->getStatus()); @@ -93,7 +93,7 @@ class SubscriptionApiController extends ApiController { */ public function unsubscribe(int $pollId): DataResponse { try { - $this->subscriptionService->set($pollId, '', false); + $this->subscriptionService->set(false, $pollId, ''); return new DataResponse(['status' => 'Unsubscribed from poll ' . $pollId], Http::STATUS_OK); } catch (Exception $e) { return new DataResponse(['message' => $e->getMessage()], $e->getStatus()); diff --git a/lib/Controller/SubscriptionController.php b/lib/Controller/SubscriptionController.php index deb640e1..b6289c46 100644 --- a/lib/Controller/SubscriptionController.php +++ b/lib/Controller/SubscriptionController.php @@ -61,7 +61,7 @@ class SubscriptionController extends Controller { */ public function subscribe(int $pollId): DataResponse { return $this->response(function () use ($pollId) { - return ['subscribed' => $this->subscriptionService->set($pollId, '', true)]; + return ['subscribed' => $this->subscriptionService->set(true, $pollId, '')]; }); } @@ -71,7 +71,7 @@ class SubscriptionController extends Controller { */ public function unsubscribe(int $pollId): DataResponse { return $this->response(function () use ($pollId) { - return ['subscribed' => $this->subscriptionService->set($pollId, '', false)]; + return ['subscribed' => $this->subscriptionService->set(false, $pollId, '')]; }); } } diff --git a/lib/Event/PollDeletedEvent.php b/lib/Event/PollDeletedEvent.php index 6862f30d..1c8e8f70 100644 --- a/lib/Event/PollDeletedEvent.php +++ b/lib/Event/PollDeletedEvent.php @@ -27,7 +27,7 @@ use OCA\Polls\Notification\Notifier; class PollDeletedEvent extends PollEvent { public function getLogMsg(): string { - return ''; // Log::MSG_ID_DELETEPOLL; + return ''; } public function getNotification(): array { diff --git a/lib/Migration/CreateIndices.php b/lib/Migration/CreateIndices.php index 623fcd93..6a3dbb84 100644 --- a/lib/Migration/CreateIndices.php +++ b/lib/Migration/CreateIndices.php @@ -31,27 +31,6 @@ use OCP\Migration\IOutput; class CreateIndices implements IRepairStep { - // private const INDICES = [ - // 'polls_options' => ['name' => 'UNIQ_options', 'unique' => true, 'columns' => ['poll_id', 'poll_option_text', 'timestamp']], - // 'polls_log' => ['name' => 'UNIQ_unprocessed', 'unique' => true, 'columns' => ['processed', 'poll_id', 'user_id', 'message_id']], - // 'polls_notif' => ['name' => 'UNIQ_subscription', 'unique' => true, 'columns' => ['poll_id', 'user_id']], - // 'polls_share' => ['name' => 'UNIQ_shares', 'unique' => true, 'columns' => ['poll_id', 'user_id']], - // 'polls_votes' => ['name' => 'UNIQ_votes', 'unique' => true, 'columns' => ['poll_id', 'user_id', 'vote_option_text']], - // 'polls_preferences' => ['name' => 'UNIQ_preferences', 'unique' => true, 'columns' => ['user_id']], - // 'polls_watch' => ['name' => 'UNIQ_watch', 'unique' => true, 'columns' => ['poll_id', 'table']], - // ]; - // - // private const PARENT_TABLE = 'polls_polls'; - // - // private const CHILD_TABLES = [ - // 'polls_comments', - // 'polls_log', - // 'polls_notif', - // 'polls_options', - // 'polls_share', - // 'polls_votes', - // ]; - /** @var Connection */ private $connection; diff --git a/lib/Migration/RemoveIndices.php b/lib/Migration/RemoveIndices.php index 79564fc8..d1617f99 100644 --- a/lib/Migration/RemoveIndices.php +++ b/lib/Migration/RemoveIndices.php @@ -48,14 +48,11 @@ class RemoveIndices implements IRepairStep { public function run(IOutput $output): void { foreach (TableSchema::FK_CHILD_TABLES as $tableName) { - // $output->info('"polls" - Removing foreign keys from '. $tableName); $this->removeForeignKeys($tableName); - // $output->info('"polls" - Removing indices in '. $tableName); $this->removeGenericIndices($tableName); } foreach (TableSchema::UNIQUE_INDICES as $tableName => $value) { - // $output->info('"polls" - Removing unique indices in '. $tableName); $this->removeUniqueIndices($tableName); } } diff --git a/lib/Migration/TableSchema.php b/lib/Migration/TableSchema.php index 0f975711..3b2459e2 100644 --- a/lib/Migration/TableSchema.php +++ b/lib/Migration/TableSchema.php @@ -102,6 +102,7 @@ abstract class TableSchema { '0108Date20210307130003', '0108Date20210307130009', '0109Date20210323120002', + '030000Date20210611120000', ]; /** @@ -137,7 +138,10 @@ abstract class TableSchema { 'full_anonymous', 'options', 'settings', - ] + ], + 'polls_comments' => [ + 'dt', + ], ]; /** diff --git a/lib/Migration/Version030000Date20210611120000.php b/lib/Migration/Version030000Date20210704120000.php index aa8d2862..f2a05ec3 100644 --- a/lib/Migration/Version030000Date20210611120000.php +++ b/lib/Migration/Version030000Date20210704120000.php @@ -37,7 +37,7 @@ use OCP\Migration\IOutput; * Changed class naming: Version[jjmmpp]Date[YYYYMMDDHHMMSS] * Version: jj = major version, mm = minor, pp = patch */ -class Version030000Date20210611120000 extends SimpleMigrationStep { +class Version030000Date20210704120000 extends SimpleMigrationStep { /** @var IDBConnection */ protected $connection; diff --git a/lib/Model/Group.php b/lib/Model/Group.php index 772be60e..28af24b8 100644 --- a/lib/Model/Group.php +++ b/lib/Model/Group.php @@ -41,13 +41,7 @@ class Group extends UserGroupClass { $this->icon = self::ICON; $this->group = self::getContainer()->query(IGroupManager::class)->get($this->id); $this->description = \OC::$server->getL10N('polls')->t('Group'); - try { - // since NC19 - $this->displayName = $this->group->getDisplayName(); - } catch (\Exception $e) { - // until NC18 - $this->displayName = $this->id; - } + $this->displayName = $this->group->getDisplayName(); } /** diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index cbafc681..2ae0d55e 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -117,6 +117,10 @@ class Notifier implements INotifier { $actor = $this->getActor($parameters['actor']); } + if (isset($actor['actor'])) { + $actor = $actor['actor']; + } + switch ($notification->getSubject()) { case self::NOTIFY_INVITATION: $notification->setParsedSubject($l->t('%s invited you to a poll', $actor['name'])); diff --git a/lib/Service/SubscriptionService.php b/lib/Service/SubscriptionService.php index fa35ea5a..558be8fe 100644 --- a/lib/Service/SubscriptionService.php +++ b/lib/Service/SubscriptionService.php @@ -69,7 +69,7 @@ class SubscriptionService { $this->subscriptionMapper->insert($subscription); } - public function set(int $pollId = 0, string $token = '', bool $subscribed): bool { + public function set(bool $subscribed, int $pollId = 0, string $token = ''): bool { if ($token) { $this->acl->setToken($token); } else { |