Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix folder visibility in private space #192

Merged
merged 3 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changelog
- Fix #184: Display only published content files in the folder "Files from the stream"
- Fix #186: Rename conflicted not published folder/file on creating/uploading
- Fix #189: Initialize module content class
- Fix #190: Fix folder visibility in private space
- Fix #191: Avoid UnknownPropertyException in validation error response

0.16.1 - May 1, 2023
Expand Down
2 changes: 1 addition & 1 deletion tests/codeception/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function createFolder($title = 'test', $description = 'test description',
$this->fillField('Folder[description]', $description);

if($isPublic) {
$this->click('[for="folder-visibility"]');
$this->jsClick('input#folder-visibility');
}

$this->click('Save', '#globalModal');
Expand Down
4 changes: 2 additions & 2 deletions tests/codeception/acceptance/VisibilityCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testVisibility(AcceptanceTester $I)
$I->fillField('Folder[description]', 'visibility2');

$I->expect('The folder visibility to be private');
$I->waitForElement('[for="folder-visibility"] input[type=checkbox]:disabled');
$I->waitForElement('input#folder-visibility:disabled');

$I->click('Save', '#globalModal');
$I->waitForText('This folder is empty.');
Expand All @@ -55,7 +55,7 @@ public function testVisibility(AcceptanceTester $I)
$I->amGoingTo('set the folder visibility to public');
$I->clickFolderContext(3, 'Edit');
$I->waitForText('Edit folder', null, '#globalModal');
$I->click('[for="folder-visibility"]');
$I->jsClick('input#folder-visibility');
$I->click('Save', '#globalModal');
$I->waitForText('visibility2', null, '#fileList');

Expand Down
7 changes: 4 additions & 3 deletions views/edit/modal_edit_folder.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use humhub\modules\ui\form\widgets\ContentHiddenCheckbox;
use humhub\modules\ui\form\widgets\ContentVisibilitySelect;
use humhub\widgets\ModalButton;
use humhub\widgets\ModalDialog;
use yii\bootstrap\ActiveForm;
Expand All @@ -24,8 +25,8 @@
<br />
<?= $form->field($folder, 'title'); ?>
<?= $form->field($folder, 'description'); ?>
<?= $form->field($folder, 'visibility')->checkbox(['disabled' => !$folder->isRoot() && $folder->parentFolder->content->isPrivate()]) ?>
<?= $form->field($folder, 'hidden')->widget(ContentHiddenCheckbox::class, []); ?>
<?= $form->field($folder, 'visibility')->widget(ContentVisibilitySelect::class, ['readonly' => !$folder->isRoot() && $folder->parentFolder->content->isPrivate()]) ?>
<?= $form->field($folder, 'hidden')->widget(ContentHiddenCheckbox::class) ?>
</div>

<div class="modal-footer">
Expand All @@ -34,4 +35,4 @@
</div>
<?php ActiveForm::end() ?>

<?php ModalDialog::end() ?>
<?php ModalDialog::end() ?>