From 1f20370b2dc06ffdab3c8147a14daeab8cb5b99a Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Mon, 6 Jun 2022 13:09:45 +0300 Subject: [PATCH 1/5] Fix OEmbed providers migration (#5748) * Fix OEmbed providers migration * Update CHANGELOG.md Co-authored-by: Lucas Bartholemy --- CHANGELOG.md | 1 + .../m220121_193617_oembed_setting_update.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25fbd5cc9e..5cfd6dbf4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ HumHub Changelog 1.11.3 (Unreleased) --------------------- - Fix #5734: Fix error message when uninstall module and module folder is not writable +- Fix #5735: OEmbed migration might fail with more complex Endpoint URLs 1.11.2 (May 30, 2022) --------------------- diff --git a/protected/humhub/migrations/m220121_193617_oembed_setting_update.php b/protected/humhub/migrations/m220121_193617_oembed_setting_update.php index 16bc2a1ba5..6e2e34ac6f 100644 --- a/protected/humhub/migrations/m220121_193617_oembed_setting_update.php +++ b/protected/humhub/migrations/m220121_193617_oembed_setting_update.php @@ -1,5 +1,6 @@ $providerEndpoint) - { + foreach (UrlOembed::getProviders() as $providerUrl => $providerEndpoint) { $providerExists = false; foreach ($oembedProviders as $provider) { - if(preg_match($provider['pattern'], $providerUrl)) { + if (preg_match($provider['pattern'], $providerUrl)) { $providerExists = true; } } - if(!$providerExists) { + if (!$providerExists) { $oembedProviders[$providerUrl] = [ - 'pattern' => '/' . str_replace('.', '\.', $providerUrl) . '/', + 'pattern' => '/' . preg_quote($providerUrl, '/') . '/', 'endpoint' => $providerEndpoint ]; } From 418f862f3d6e6f6c541ebf07e45d57f15b78af0f Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Tue, 7 Jun 2022 18:14:27 +0300 Subject: [PATCH 2/5] Fix logout action on force change password (#5749) Co-authored-by: Lucas Bartholemy --- CHANGELOG.md | 1 + protected/humhub/components/access/ControllerAccess.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cfd6dbf4a..e5296f0ce0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ HumHub Changelog 1.11.3 (Unreleased) --------------------- - Fix #5734: Fix error message when uninstall module and module folder is not writable +- Fix #5740: Fix logout action on force change password - Fix #5735: OEmbed migration might fail with more complex Endpoint URLs 1.11.2 (May 30, 2022) diff --git a/protected/humhub/components/access/ControllerAccess.php b/protected/humhub/components/access/ControllerAccess.php index 85e4b5ce64..6ed2786618 100644 --- a/protected/humhub/components/access/ControllerAccess.php +++ b/protected/humhub/components/access/ControllerAccess.php @@ -528,7 +528,8 @@ class ControllerAccess extends BaseObject */ public function validateMustChangePassword() { - return $this->isGuest() || Yii::$app->user->isMustChangePasswordUrl() || !$this->user->mustChangePassword(); + return $this->isGuest() || Yii::$app->user->isMustChangePasswordUrl() || !$this->user->mustChangePassword() || + ($this->owner->module->id == 'user' && $this->owner->id == 'auth' && $this->owner->action->id == 'logout'); } /** From be2b8f1f7323a87c8bbc1171a727dfe502cdb97c Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Thu, 9 Jun 2022 14:32:55 +0300 Subject: [PATCH 3/5] Fix user approving/declining (#5737) Co-authored-by: Lucas Bartholemy --- CHANGELOG.md | 1 + .../admin/controllers/ApprovalController.php | 18 ++++++---- .../admin/models/forms/ApproveUserForm.php | 35 +++++++++---------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5296f0ce0..7f6dea2d37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ HumHub Changelog 1.11.3 (Unreleased) --------------------- +- Fix: #5736: Fix status message on user approval - Fix #5734: Fix error message when uninstall module and module folder is not writable - Fix #5740: Fix logout action on force change password - Fix #5735: OEmbed migration might fail with more complex Endpoint URLs diff --git a/protected/humhub/modules/admin/controllers/ApprovalController.php b/protected/humhub/modules/admin/controllers/ApprovalController.php index 46835f1a36..067f71b25c 100644 --- a/protected/humhub/modules/admin/controllers/ApprovalController.php +++ b/protected/humhub/modules/admin/controllers/ApprovalController.php @@ -135,9 +135,12 @@ class ApprovalController extends Controller { $model = new ApproveUserForm($id); $model->setApprovalDefaults(); - if ($model->load(Yii::$app->request->post()) && $model->approve()) { - $this->view->success(Yii::t('AdminModule.user', 'The registration was approved and the user was notified by email.')); - return $this->redirect(['index']); + if ($model->load(Yii::$app->request->post())) { + if ($model->approve()) { + $this->view->success(Yii::t('AdminModule.user', 'The registration was approved and the user was notified by email.')); + return $this->redirect(['index']); + } + $this->view->error(Yii::t('AdminModule.user', 'Could not approve the user!')); } return $this->render('approve', [ @@ -157,9 +160,12 @@ class ApprovalController extends Controller { $model = new ApproveUserForm($id); $model->setDeclineDefaults(); - if ($model->load(Yii::$app->request->post()) && $model->decline()) { - $this->view->success(Yii::t('AdminModule.user', 'The registration was declined and the user was notified by email.')); - return $this->redirect(['index']); + if ($model->load(Yii::$app->request->post())) { + if ($model->decline()) { + $this->view->success(Yii::t('AdminModule.user', 'The registration was declined and the user was notified by email.')); + return $this->redirect(['index']); + } + $this->view->error(Yii::t('AdminModule.user', 'Could not decline the user!')); } return $this->render('decline', [ diff --git a/protected/humhub/modules/admin/models/forms/ApproveUserForm.php b/protected/humhub/modules/admin/models/forms/ApproveUserForm.php index 6de69f2349..2f2567e8cb 100644 --- a/protected/humhub/modules/admin/models/forms/ApproveUserForm.php +++ b/protected/humhub/modules/admin/models/forms/ApproveUserForm.php @@ -146,21 +146,22 @@ class ApproveUserForm extends \yii\base\Model * Approves user by sending approval mail and updating user status and running initial approval logic. * @return bool */ - public function approve() + public function approve(): bool { if (!$this->message) { $this->setApprovalDefaults(); } - if (!$this->validate()) { - return false; + $this->user->status = User::STATUS_ENABLED; + + if ($this->validate() && + $this->user->save() && + $this->send()) { + $this->user->setUpApproved(); + return true; } - $this->send(); - $this->user->status = User::STATUS_ENABLED; - $this->user->save(); - $this->user->setUpApproved(); - return true; + return false; } /** @@ -169,19 +170,15 @@ class ApproveUserForm extends \yii\base\Model * @throws \Throwable * @throws \yii\db\StaleObjectException */ - public function decline() + public function decline(): bool { if (!$this->message) { $this->setDeclineDefaults(); } - if (!$this->validate()) { - return false; - } - - $this->send(); - $this->user->delete(); - return true; + return $this->validate() && + $this->send() && + $this->user->delete(); } /** @@ -221,16 +218,16 @@ class ApproveUserForm extends \yii\base\Model } /** - * @return void + * @return bool */ - public function send() + public function send(): bool { $mail = Yii::$app->mailer->compose(['html' => '@humhub/views/mail/TextOnly'], [ 'message' => RichTextToEmailHtmlConverter::process($this->message) ]); $mail->setTo($this->user->email); $mail->setSubject($this->subject); - $mail->send(); + return $mail->send(); } /** From 8e9fdf214de7488ba2269f7101ecb597c93b8e6f Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Tue, 14 Jun 2022 15:56:08 +0300 Subject: [PATCH 4/5] Fix tests on enable space module (#5759) * Fix tests on enable space module * Update CHANGELOG.md (#5759) --- CHANGELOG.md | 1 + .../humhub/tests/codeception/_support/AcceptanceTester.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f6dea2d37..a95d7c053d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ HumHub Changelog - Fix #5734: Fix error message when uninstall module and module folder is not writable - Fix #5740: Fix logout action on force change password - Fix #5735: OEmbed migration might fail with more complex Endpoint URLs +- Fix #5759: Fix tests on enable space module 1.11.2 (May 30, 2022) --------------------- diff --git a/protected/humhub/tests/codeception/_support/AcceptanceTester.php b/protected/humhub/tests/codeception/_support/AcceptanceTester.php index 4f45fa7dc7..776618010b 100644 --- a/protected/humhub/tests/codeception/_support/AcceptanceTester.php +++ b/protected/humhub/tests/codeception/_support/AcceptanceTester.php @@ -254,7 +254,7 @@ class AcceptanceTester extends BaseTester { $this->amOnSpace($guid, '/space/manage/module'); $this->seeElement('.enable-module-'.$moduleId); - $this->click('.enable-module-'.$moduleId); + $this->jsClick('.enable-module-'.$moduleId); $this->waitForElement('.disable-module-'.$moduleId); $this->amOnSpace($guid); } From 9736bdeea56fc9a3b6e8f28c6cde15fb02066a69 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Wed, 15 Jun 2022 12:21:39 +0300 Subject: [PATCH 5/5] Fix context menu position on the right window side (#5760) * Fix context menu position on the right window side * Update CHANGELOG.md (#5760) Co-authored-by: Lucas Bartholemy --- CHANGELOG.md | 2 ++ static/js/humhub/humhub.ui.additions.js | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a95d7c053d..988ac0a816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,10 @@ HumHub Changelog - Fix #5734: Fix error message when uninstall module and module folder is not writable - Fix #5740: Fix logout action on force change password - Fix #5735: OEmbed migration might fail with more complex Endpoint URLs +- Fix #5760: Fix context menu position on the right window side - Fix #5759: Fix tests on enable space module + 1.11.2 (May 30, 2022) --------------------- - Fix: #5652: Fix undefined UrlOembed provider pattern diff --git a/static/js/humhub/humhub.ui.additions.js b/static/js/humhub/humhub.ui.additions.js index 8ac3ed37f3..e80de56993 100644 --- a/static/js/humhub/humhub.ui.additions.js +++ b/static/js/humhub/humhub.ui.additions.js @@ -380,8 +380,9 @@ humhub.module('ui.additions', function (module, require, $) { settings.menuSelected.call(this, $invokedOn, $selectedMenu, e); }); - if ($menu.position().left + $menu.outerWidth() > $(window).width()) { - $menu.css('left', $(window).outerWidth() - $menu.width() - 5); + var menuShift = $menu.offset().left + $menu.outerWidth() - $(window).width(); + if (menuShift > 0) { + $menu.css('left', $menu.position().left - menuShift - 5); } return false;