Merge branch 'master' into develop

This commit is contained in:
Lucas Bartholemy 2022-06-16 14:18:38 +02:00
commit 2f675a87fe
7 changed files with 45 additions and 30 deletions

View File

@ -3,7 +3,13 @@ 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
- 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)
---------------------

View File

@ -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');
}
/**

View File

@ -1,5 +1,6 @@
<?php
use humhub\models\UrlOembed;
use yii\db\Migration;
use yii\helpers\Json;
@ -52,19 +53,18 @@ class m220121_193617_oembed_setting_update extends Migration
]
];
foreach (\humhub\models\UrlOembed::getProviders() as $providerUrl => $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
];
}

View File

@ -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', [

View File

@ -146,7 +146,7 @@ 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();
@ -156,11 +156,16 @@ class ApproveUserForm extends \yii\base\Model
return false;
}
$this->send();
$this->user->status = User::STATUS_ENABLED;
$this->user->save();
return true;
if ($this->validate() &&
$this->user->save() &&
$this->send()) {
$this->user->setUpApproved();
return true;
}
return false;
}
/**
@ -169,19 +174,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 +222,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();
}
/**

View File

@ -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);
}

View File

@ -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;