mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix #3940: Empty visibility for some new spaces
This commit is contained in:
parent
b1db317965
commit
f681940d30
@ -9,6 +9,8 @@ HumHub Change Log
|
||||
- Fix #3914: Directory link in space chooser still visible when directory module not active
|
||||
- Fix #3915: Removed default border from canvas style
|
||||
- Fix #3885: Prevent comments on archived content
|
||||
- Fix #3940: Empty visibility for some new spaces
|
||||
|
||||
|
||||
1.4.3 (March 4, 2020)
|
||||
---------------------
|
||||
|
@ -83,9 +83,11 @@ class CreateController extends Controller
|
||||
$visibilityOptions[Space::VISIBILITY_NONE] = Yii::t('SpaceModule.base', 'Private (Invisible)');
|
||||
}
|
||||
|
||||
// allow setting pre-selected visibility
|
||||
if ($visibility !== null && isset($visibilityOptions[$visibility])) {
|
||||
// allow setting pre-selected visibility
|
||||
$model->visibility = $visibility;
|
||||
} elseif (!isset($visibilityOptions[$model->visibility])) {
|
||||
$model->visibility = array_key_first($visibilityOptions);
|
||||
}
|
||||
|
||||
$joinPolicyOptions = [
|
||||
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m200323_162006_fix_visibility
|
||||
*/
|
||||
class m200323_162006_fix_visibility extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->update('space', ['visibility' => 0], 'visibility IS NULL');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
echo "m200323_162006_fix_visibility cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m200323_162006_fix_visibility cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
@ -241,6 +241,11 @@ class Space extends ContentContainerActiveRecord implements Searchable
|
||||
$this->url = mb_strtolower($this->url);
|
||||
}
|
||||
|
||||
// Make sure visibility attribute is not empty
|
||||
if (empty($this->visibility)) {
|
||||
$this->visibility = self::VISIBILITY_NONE;
|
||||
}
|
||||
|
||||
if ($this->visibility == self::VISIBILITY_NONE) {
|
||||
$this->join_policy = self::JOIN_POLICY_NONE;
|
||||
$this->default_content_visibility = Content::VISIBILITY_PRIVATE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user