Merge branch 'master' into develop

This commit is contained in:
Lucas Bartholemy 2023-09-12 15:44:14 +02:00
commit f0879da513
12 changed files with 66 additions and 30 deletions

View File

@ -1,6 +1,19 @@
HumHub Changelog
================
1.14.4 (Unreleased)
----------------------
- Fix #6489: Never delete original file on store new version
- Fix #6507: Reload page after accepting of invite in Space header
- Fix #6531: Fix active style for `btn-lg`
- Fix #6534: Cannot change Homepage of space in PHP 8.x
- Fix #6543: Fix errors of inside modal actions
- Fix #6539: Fix overriding of loaded value with default value on HForm
- Fix #6464: Fix access to own user container
- Fix #6349: Fix error on login new user from external service when maintenance is enabled
- Fix #6557: Fix not initialized groups array on the module administration
- Fix #6556: Fix command `theme/switch`
1.14.3 (July 27, 2023)
----------------------
- Fix #6345: Fix updating of post on wall stream

View File

@ -18,6 +18,7 @@ use humhub\modules\ui\form\widgets\SortOrderField;
use Yii;
use yii\helpers\Html;
use yii\widgets\ActiveField;
use yii\widgets\ActiveForm;
/**
* HForm - Yii1 compatible form generator

View File

@ -157,13 +157,15 @@ class ContentContainerControllerAccess extends StrictAccess
*/
public function isAdmin()
{
if(parent::isAdmin()) {
if (parent::isAdmin()) {
return true;
}
if ($this->contentContainer instanceof Space) {
return $this->contentContainer->isAdmin($this->user);
} elseif($this->contentContainer instanceof Space) {
}
if ($this->contentContainer instanceof User) {
return $this->user && $this->user->is($this->contentContainer);
}

View File

@ -350,7 +350,7 @@ class File extends FileCompat
FileHistory::createEntryForFile($this);
}
$this->store->delete(null, [FileHistory::VARIANT_PREFIX . '*']);
$this->store->delete(null, ['file', FileHistory::VARIANT_PREFIX . '*']);
}
/**

View File

@ -142,16 +142,16 @@ class AdvancedSettings extends Model
$this->space->url = $this->url;
if ($this->space->isAttributeChanged('url')) {
if ($this->indexUrl) {
if ($this->indexUrl && $oldUrl = $this->space->getOldAttribute('url')) {
$this->indexUrl = str_replace(
$this->space->getOldAttribute('url'),
$oldUrl,
$this->space->url,
$this->indexUrl
);
}
if ($this->indexGuestUrl) {
if ($this->indexGuestUrl && $oldUrl = $this->space->getOldAttribute('url')) {
$this->indexGuestUrl = str_replace(
$this->space->getOldAttribute('url'),
$oldUrl,
$this->space->url,
$this->indexGuestUrl
);

View File

@ -39,7 +39,7 @@ class MembershipButton extends Widget
return [
'requestMembership' => [
'title' => Yii::t('SpaceModule.base', 'Join'),
'url' => $this->space->createUrl('/space/membership/request-membership-form', ['options' => Json::encode($this->options)]),
'url' => $this->space->createUrl('/space/membership/request-membership-form', empty($this->options) ? [] : ['options' => Json::encode($this->options)]),
'attrs' => [
'class' => 'btn btn-info',
'data-space-request-membership' => $this->space->id,
@ -48,7 +48,6 @@ class MembershipButton extends Widget
],
'becomeMember' => [
'title' => Yii::t('SpaceModule.base', 'Join'),
'mode' => 'ajax', // 'ajax' - to use data-action-* options for AJAX request, 'link' - to use button as simple <a> link
'url' => '#',
'attrs' => [
'data-action-click' => 'content.container.relationship',
@ -61,6 +60,7 @@ class MembershipButton extends Widget
],
'acceptInvite' => [
'title' => Yii::t('SpaceModule.base', 'Accept Invite'),
'url' => '#',
'attrs' => [
'data-action-click' => 'content.container.relationship',
'data-action-url' => $this->space->createUrl('/space/membership/invite-accept'),
@ -73,6 +73,7 @@ class MembershipButton extends Widget
],
'declineInvite' => [
'title' => Yii::t('SpaceModule.base', 'Decline Invite'),
'url' => '#',
'attrs' => [
'data-action-click' => 'content.container.relationship',
'data-action-url' => $this->space->createUrl('/space/membership/revoke-membership'),
@ -82,6 +83,7 @@ class MembershipButton extends Widget
],
'cancelPendingMembership' => [
'title' => '<span class="glyphicon glyphicon-time"></span>&nbsp;&nbsp;' . Yii::t('SpaceModule.base', 'Pending'),
'url' => '#',
'attrs' => [
'data-action-click' => 'content.container.relationship',
'data-action-url' => $this->space->createUrl('/space/membership/revoke-membership'),
@ -94,6 +96,7 @@ class MembershipButton extends Widget
'cancelMembership' => [
'visible' => false,
'title' => '<span class="glyphicon glyphicon-ok"></span>&nbsp;&nbsp;' . Yii::t('SpaceModule.base', 'Member'),
'url' => '#',
'attrs' => [
'data-action-click' => 'content.container.relationship',
'data-action-url' => $this->space->createUrl('/space/membership/revoke-membership'),
@ -123,7 +126,7 @@ class MembershipButton extends Widget
$defaultOptions = $this->getDefaultOptions();
}
return ArrayHelper::merge($defaultOptions, $this->options);
return $this->prepareButtonOptions(ArrayHelper::merge($defaultOptions, $this->options));
}
/**
@ -135,22 +138,29 @@ class MembershipButton extends Widget
return '';
}
$options = $this->getOptions();
if ($options['becomeMember']['mode'] == 'link') {
// Switch button "Join" to link mode
$options['becomeMember']['url'] = $options['becomeMember']['attrs']['data-action-url'];
$options['becomeMember']['attrs']['data-method'] = 'POST';
unset($options['becomeMember']['attrs']['data-action-click']);
unset($options['becomeMember']['attrs']['data-action-url']);
}
return $this->render('membershipButton', [
'space' => $this->space,
'membership' => $this->space->getMembership(),
'options' => $options,
'options' => $this->getOptions(),
'canCancelMembership' => !$this->space->isSpaceOwner() && $this->space->canLeave(),
]);
}
private function prepareButtonOptions(array $options): array
{
foreach ($options as $b => $button) {
if (isset($button['mode']) && $button['mode'] === 'link' && isset($button['attrs']['data-action-url'])) {
// Switch button to link mode
$button['url'] = $button['attrs']['data-action-url'];
$button['attrs']['data-method'] = $button['mode_method'] ?? 'POST';
unset($button['attrs']['data-action-click']);
unset($button['attrs']['data-action-url']);
unset($button['attrs']['data-button-options']);
$options[$b] = $button;
}
}
return $options;
}
}

View File

@ -20,21 +20,21 @@ if ($membership === null) {
} elseif ($membership->status == Membership::STATUS_INVITED) {
?>
<div class="<?= $options['acceptInvite']['groupClass'] ?>">
<?= Html::a($options['acceptInvite']['title'], '#', $options['acceptInvite']['attrs']); ?>
<?= Html::a($options['acceptInvite']['title'], $options['acceptInvite']['url'], $options['acceptInvite']['attrs']); ?>
<button type="button" class="<?= $options['acceptInvite']['togglerClass'] ?> dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><?= Html::a($options['declineInvite']['title'], '#', $options['declineInvite']['attrs']); ?></li>
<li><?= Html::a($options['declineInvite']['title'], $options['declineInvite']['url'], $options['declineInvite']['attrs']); ?></li>
</ul>
</div>
<?php
} elseif ($membership->status == Membership::STATUS_APPLICANT) {
echo Html::a($options['cancelPendingMembership']['title'], $space->createUrl('/space/membership/revoke-membership'), $options['cancelPendingMembership']['attrs']);
echo Html::a($options['cancelPendingMembership']['title'], $options['cancelPendingMembership']['url'], $options['cancelPendingMembership']['attrs']);
} elseif ($membership->status == Membership::STATUS_MEMBER) {
if ($canCancelMembership && $options['cancelMembership']['visible']) {
echo Html::a($options['cancelMembership']['title'], '#', $options['cancelMembership']['attrs']);
echo Html::a($options['cancelMembership']['title'], $options['cancelMembership']['url'], $options['cancelMembership']['attrs']);
} elseif (!$canCancelMembership && $options['cannotCancelMembership']['visible']) {
$memberTitle = ($space->isSpaceOwner() ? $options['cannotCancelMembership']['ownerTitle'] : $options['cannotCancelMembership']['memberTitle']);
echo Html::a($memberTitle, $space->createUrl(), $options['cannotCancelMembership']['attrs']);

View File

@ -23,7 +23,10 @@ use humhub\modules\space\widgets\MembershipButton;
[InviteButton::class, ['space' => $container], ['sortOrder' => 10]],
[MembershipButton::class, [
'space' => $container,
'options' => ['becomeMember' => ['mode' => 'link']],
'options' => [
'becomeMember' => ['mode' => 'link'],
'acceptInvite' => ['mode' => 'link']
],
], ['sortOrder' => 20]],
[FollowButton::class, [
'space' => $container,
@ -37,4 +40,3 @@ use humhub\modules\space\widgets\MembershipButton;
</div>
</div>
</div>

View File

@ -8,6 +8,8 @@
namespace humhub\modules\ui\commands;
use humhub\libs\DynamicConfig;
use humhub\modules\ui\view\bootstrap\ThemeLoader;
use humhub\modules\ui\view\helpers\ThemeHelper;
use Yii;
use yii\console\ExitCode;
@ -72,6 +74,8 @@ class ThemeController extends \yii\console\Controller
}
$theme->activate();
DynamicConfig::rewrite();
(new ThemeLoader())->bootstrap(Yii::$app);
$this->stdout("\nSuccessfully switched to theme: \n", Console::BOLD);
$this->stdout(Yii::$app->view->theme->name . "\n\n", Console::FG_GREEN);

View File

@ -158,7 +158,8 @@ class AuthController extends Controller
$user = $authClientService->getUser();
if (Yii::$app->settings->get('maintenanceMode') && !$user->isSystemAdmin()) {
if (Yii::$app->settings->get('maintenanceMode') && !($user && $user->isSystemAdmin())) {
Yii::$app->getView()->warn(ControllerAccess::getMaintenanceModeWarningText());
return $this->redirect(['/user/auth/login']);
}

View File

@ -188,7 +188,7 @@ humhub.module('client', function (module, require, $) {
} else if (cfg instanceof $.Event) {
originalEvent = cfg;
cfg = {};
} else if (!object.isString(url)) {
} else if (url && !object.isString(url)) {
cfg = url;
url = cfg.url;
}

View File

@ -24,8 +24,11 @@
outline: none;
}
.btn-lg {
.btn.btn-lg {
padding: 16px 28px;
&:active, &.active {
padding: 15px 27px;
}
}
.btn-sm {