From d9b60936fdb479a0590bc7419dcc9329d9aeb98f Mon Sep 17 00:00:00 2001 From: Lucas Bartholemy Date: Thu, 29 Jan 2026 10:30:59 +0100 Subject: [PATCH 1/7] Refactor Activity Handling --- activities/NewVote.php | 40 ++++++++++++------------------------ activities/views/newVote.php | 9 -------- models/Poll.php | 7 +++---- 3 files changed, 16 insertions(+), 40 deletions(-) delete mode 100644 activities/views/newVote.php diff --git a/activities/NewVote.php b/activities/NewVote.php index f9466b11..71a0a374 100644 --- a/activities/NewVote.php +++ b/activities/NewVote.php @@ -1,43 +1,29 @@ '' . Html::encode($originator->displayName) . '', - '{question}' => $this->context->getContentInfo($source) -]); -?> diff --git a/models/Poll.php b/models/Poll.php index e43ce5ab..88fb216d 100644 --- a/models/Poll.php +++ b/models/Poll.php @@ -2,7 +2,9 @@ namespace humhub\modules\polls\models; +use humhub\modules\activity\services\ActivityManager; use humhub\modules\content\widgets\richtext\RichText; +use humhub\modules\polls\activities\NewVote; use humhub\modules\polls\permissions\CreatePoll; use humhub\modules\search\interfaces\Searchable; use humhub\modules\content\components\ContentActiveRecord; @@ -309,10 +311,7 @@ public function vote($votes = []) } if ($voted && !$this->anonymous) { - $activity = new \humhub\modules\polls\activities\NewVote(); - $activity->source = $this; - $activity->originator = Yii::$app->user->getIdentity(); - $activity->create(); + ActivityManager::dispatch(NewVote::class, $this); } return $voted; From bd9bd01ee0badb78607d6e05e887fb7acd5fa3be Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 29 Jan 2026 09:31:21 +0000 Subject: [PATCH 2/7] Autocommit PHP CS Fixer --- activities/NewVote.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activities/NewVote.php b/activities/NewVote.php index 71a0a374..6c38f3fd 100644 --- a/activities/NewVote.php +++ b/activities/NewVote.php @@ -26,4 +26,4 @@ protected function getMessage(array $params): string return Yii::t('PollsModule.base', '{userName} answered the {question}.', $params); } -} \ No newline at end of file +} From 77c1a4e3c8ce84e8d9d8ea09cec0deb4f3b20421 Mon Sep 17 00:00:00 2001 From: Lucas Bartholemy Date: Thu, 29 Jan 2026 10:32:26 +0100 Subject: [PATCH 3/7] Update max. Version --- module.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module.json b/module.json index 67254fad..e3ef9ef1 100644 --- a/module.json +++ b/module.json @@ -5,7 +5,8 @@ "keywords": ["poll", "voting", "decision making"], "version": "1.4.3", "humhub": { - "minVersion": "1.18" + "minVersion": "1.18", + "maxVersion": "1.18" }, "homepage": "https://github.com/humhub/polls", "authors": [ From f358bab60db5bf0b95a57b72711fecc1ac0dd9db Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 29 Jan 2026 09:33:01 +0000 Subject: [PATCH 4/7] Autocommit PHP CS Fixer --- activities/NewVote.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activities/NewVote.php b/activities/NewVote.php index 71a0a374..6c38f3fd 100644 --- a/activities/NewVote.php +++ b/activities/NewVote.php @@ -26,4 +26,4 @@ protected function getMessage(array $params): string return Yii::t('PollsModule.base', '{userName} answered the {question}.', $params); } -} \ No newline at end of file +} From ee0e0da4492663815ba128e8bf2a72c4aa165bbf Mon Sep 17 00:00:00 2001 From: Lucas Bartholemy Date: Thu, 29 Jan 2026 10:43:46 +0100 Subject: [PATCH 5/7] Update minVersion for HumHub to 1.19 --- module.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module.json b/module.json index e3ef9ef1..b2db882e 100644 --- a/module.json +++ b/module.json @@ -5,8 +5,7 @@ "keywords": ["poll", "voting", "decision making"], "version": "1.4.3", "humhub": { - "minVersion": "1.18", - "maxVersion": "1.18" + "minVersion": "1.19" }, "homepage": "https://github.com/humhub/polls", "authors": [ From 01dc03ad021c9747078451d279547c5271ff75cc Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 29 Jan 2026 09:44:08 +0000 Subject: [PATCH 6/7] Autocommit PHP CS Fixer --- activities/NewVote.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activities/NewVote.php b/activities/NewVote.php index 71a0a374..6c38f3fd 100644 --- a/activities/NewVote.php +++ b/activities/NewVote.php @@ -26,4 +26,4 @@ protected function getMessage(array $params): string return Yii::t('PollsModule.base', '{userName} answered the {question}.', $params); } -} \ No newline at end of file +} From 10611659ae26dbdae3ed81b54cab47f0506b5814 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Fri, 13 Mar 2026 16:44:37 +0300 Subject: [PATCH 7/7] Update for HumHub 1.19 --- controllers/PollController.php | 12 +++++----- docs/CHANGELOG.md | 6 ++++- migrations/m150709_151858_namespace.php | 17 +++++++++++---- models/Poll.php | 3 +-- module.json | 2 +- widgets/views/closeButton.php | 29 ++++++++++++++----------- widgets/views/resetButton.php | 17 ++++++++++----- 7 files changed, 53 insertions(+), 33 deletions(-) diff --git a/controllers/PollController.php b/controllers/PollController.php index 051adc33..347d4814 100644 --- a/controllers/PollController.php +++ b/controllers/PollController.php @@ -6,7 +6,7 @@ use humhub\modules\polls\models\Poll; use humhub\modules\polls\models\PollAnswer; use humhub\modules\polls\widgets\WallCreateForm; -use humhub\modules\stream\actions\Stream; +use humhub\modules\stream\actions\StreamEntryResponse; use humhub\modules\user\models\User; use humhub\modules\user\widgets\UserListBox; use humhub\helpers\Html; @@ -67,7 +67,7 @@ public function actionReload($id) throw new HttpException(403); } - return $this->asJson(Stream::getContentResultEntry($model->content)); + return $this->asJson(StreamEntryResponse::getAsArray($model->content)); } public function actionEdit() @@ -95,7 +95,7 @@ public function actionEdit() if ($model->validate() && $model->save()) { // Reload record to get populated updated_at field $model = Poll::findOne(['id' => $id]); - return Stream::getContentResultEntry($model->content); + return StreamEntryResponse::getAsArray($model->content); } else { $result['errors'] = $model->getErrors(); } @@ -131,7 +131,7 @@ public function setClosed($id, $closed) // Refresh updated_at $model->content->refresh(); - return Stream::getContentResultEntry($model->content); + return StreamEntryResponse::getAsArray($model->content); } /** @@ -159,7 +159,7 @@ public function actionAnswer() $poll->vote($votes); - return Stream::getContentResultEntry($poll->content); + return StreamEntryResponse::getAsArray($poll->content); } /** @@ -169,7 +169,7 @@ public function actionAnswerReset() { $poll = $this->getPollByParameter(); $poll->resetAnswer(); - return $this->asJson(Stream::getContentResultEntry($poll->content)); + return $this->asJson(StreamEntryResponse::getAsArray($poll->content)); } /** diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index eeff39a3..bfafd9d2 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,7 +1,11 @@ Changelog ========= -1.4.5 (Feburary 27, 2026) +1.5.0 (Unreleased) +------------------------- +- Enh #174: Update for HumHub 1.19 + +1.4.5 (February 27, 2026) ------------------------- - Fix #173: Alignment on large screens and Enterprise Theme diff --git a/migrations/m150709_151858_namespace.php b/migrations/m150709_151858_namespace.php index 58d0d3cb..09423509 100644 --- a/migrations/m150709_151858_namespace.php +++ b/migrations/m150709_151858_namespace.php @@ -1,15 +1,24 @@ renameClass('Poll', humhub\modules\polls\models\Poll::className()); - $this->update('activity', ['class' => 'humhub\modules\content\activities\ContentCreated', 'module' => 'content'], ['class' => 'PollCreated']); - $this->update('activity', ['class' => 'humhub\modules\polls\activities\NewVote', 'module' => 'polls'], ['class' => 'PollAnswered']); + $this->renameClass('Poll', Poll::class); + + $table = $this->db->getTableSchema('activity'); + $columnsContentCreated = ['class' => 'humhub\modules\content\activities\ContentCreated']; + $columnsNewVote = ['class' => 'humhub\modules\polls\activities\NewVote']; + if (isset($table->columns['module'])) { + $columnsContentCreated['module'] = 'content'; + $columnsNewVote['module'] = 'polls'; + } + + $this->update('activity', $columnsContentCreated, ['class' => 'PollCreated']); + $this->update('activity', $columnsNewVote, ['class' => 'PollAnswered']); } public function down() diff --git a/models/Poll.php b/models/Poll.php index 88fb216d..6b05b9bb 100644 --- a/models/Poll.php +++ b/models/Poll.php @@ -6,7 +6,6 @@ use humhub\modules\content\widgets\richtext\RichText; use humhub\modules\polls\activities\NewVote; use humhub\modules\polls\permissions\CreatePoll; -use humhub\modules\search\interfaces\Searchable; use humhub\modules\content\components\ContentActiveRecord; use Yii; @@ -34,7 +33,7 @@ * @since 0.5 * @author Luke */ -class Poll extends ContentActiveRecord implements Searchable +class Poll extends ContentActiveRecord { public const MIN_REQUIRED_ANSWERS = 2; public const SCENARIO_CREATE = 'create'; diff --git a/module.json b/module.json index 8605c2a2..82eaa80f 100644 --- a/module.json +++ b/module.json @@ -3,7 +3,7 @@ "name": "Polls", "description": "Easily create polls, streamline decision-making, and harness the power of voting.", "keywords": ["poll", "voting", "decision making"], - "version": "1.4.5", + "version": "1.5.0", "humhub": { "minVersion": "1.19" }, diff --git a/widgets/views/closeButton.php b/widgets/views/closeButton.php index dc3f2b34..6d4b4d53 100644 --- a/widgets/views/closeButton.php +++ b/widgets/views/closeButton.php @@ -1,15 +1,18 @@ +
  • - closed) : ?> - - - - - - - - - - + closed + ? Link::to(Yii::t('PollsModule.base', 'Reopen Poll')) + ->action('close', $poll->content->container->createUrl('/polls/poll/open', ['id' => $poll->id]), '[data-poll=' . $poll->id . ']') + ->icon('check') + ->cssClass('dropdown-item') + : Link::to(Yii::t('PollsModule.base', 'Close Poll')) + ->action('close', $poll->content->container->createUrl('/polls/poll/close', ['id' => $poll->id]), '[data-poll=' . $poll->id . ']') + ->icon('times') + ->cssClass('dropdown-item') ?>
  • diff --git a/widgets/views/resetButton.php b/widgets/views/resetButton.php index d5198ffb..e0bf3959 100644 --- a/widgets/views/resetButton.php +++ b/widgets/views/resetButton.php @@ -1,8 +1,13 @@ +
  • - - - - + action('reset', $poll->content->container->createUrl('/polls/poll/answer-reset', ['pollId' => $poll->id]), '[data-poll=' . $poll->id . ']') + ->icon('undo') + ->cssClass('dropdown-item') ?>