mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix visibility of draft and scheduled content on dashboard (#6674)
* Fix visibility of draft and scheduled content on dashboard * Test visibility of draft and scheduled content on dashboard
This commit is contained in:
parent
ae8f2fa342
commit
5a026939a5
@ -10,6 +10,7 @@ HumHub Changelog
|
||||
- Fix #6656: Fix people and space filters
|
||||
- Fix #6652: Fix profile update on welcome page
|
||||
- Fix #6660: Fix memory usage on integrity check
|
||||
- Fix #6674: Fix visibility of draft and scheduled content on dashboard
|
||||
|
||||
|
||||
1.15.0 (November 6, 2023)
|
||||
|
@ -21,11 +21,18 @@ class DraftCest
|
||||
|
||||
$I->wantTo('ensure draft has a draft badge.');
|
||||
$I->waitForText('DRAFT', '5', '//div[@class="wall-entry"][1]');
|
||||
$I->wantTo('ensure author can see the draft content on dashboard.');
|
||||
$I->amOnDashboard();
|
||||
$I->waitForText('Schabernack', null, '[data-stream-entry="1"]');
|
||||
$I->waitForText('DRAFT', null, '[data-stream-entry="1"]');
|
||||
|
||||
$I->wantTo('ensure draft is not visible for other users.');
|
||||
$I->amUser2(true);
|
||||
$I->amOnSpace3();
|
||||
$I->dontSee('Schabernack');
|
||||
$I->amOnDashboard();
|
||||
$I->waitForElementVisible('[data-stream-entry="1"]');
|
||||
$I->dontSee('Schabernack');
|
||||
|
||||
$I->wantTo('publish draft');
|
||||
$I->amSpaceAdmin(true, 3);
|
||||
|
@ -24,11 +24,18 @@ class ScheduledCest
|
||||
$I->wantTo('ensure the scheduled content has a proper badge.');
|
||||
$I->waitForText($postContent, null, '.wall-entry');
|
||||
$I->see($this->getLabelText($datetime), '//div[@class="wall-entry"][1]');
|
||||
$I->wantTo('ensure author can see the scheduled content on dashboard.');
|
||||
$I->amOnDashboard();
|
||||
$I->waitForText($postContent, null, '[data-stream-entry="1"]');
|
||||
$I->waitForText($this->getLabelText($datetime), null, '[data-stream-entry="1"]');
|
||||
|
||||
$I->wantTo('ensure draft is not visible for other users.');
|
||||
$I->wantTo('ensure the scheduled content is not visible for other users.');
|
||||
$I->amUser2(true);
|
||||
$I->amOnSpace3();
|
||||
$I->dontSee($postContent);
|
||||
$I->amOnDashboard();
|
||||
$I->waitForElementVisible('[data-stream-entry="1"]');
|
||||
$I->dontSee($postContent);
|
||||
|
||||
$I->wantTo('update scheduled options of the existing content');
|
||||
$I->amSpaceAdmin(true, 3);
|
||||
|
@ -27,21 +27,26 @@ class DraftContentStreamFilter extends StreamQueryFilter
|
||||
|
||||
if ($this->allowPinContent()) {
|
||||
$this->fetchDraftContent();
|
||||
} else {
|
||||
$this->streamQuery->stateFilterCondition[] = ['content.state' => Content::STATE_DRAFT];
|
||||
} elseif (!Yii::$app->user->isGuest) {
|
||||
$this->streamQuery->stateFilterCondition[] = $this->getDraftCondition();
|
||||
}
|
||||
}
|
||||
|
||||
private function getDraftCondition(): array
|
||||
{
|
||||
return ['AND',
|
||||
['content.state' => Content::STATE_DRAFT],
|
||||
['content.created_by' => Yii::$app->user->id]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function fetchDraftContent(): void
|
||||
{
|
||||
$draftQuery = clone $this->query;
|
||||
$draftQuery->andWhere([
|
||||
'AND', ['content.state' => Content::STATE_DRAFT],
|
||||
['content.created_by' => Yii::$app->user->id]]
|
||||
);
|
||||
$draftQuery->andWhere($this->getDraftCondition());
|
||||
$draftQuery->limit(100);
|
||||
$this->draftContent = $draftQuery->all();
|
||||
}
|
||||
|
@ -32,21 +32,26 @@ class ScheduledContentStreamFilter extends StreamQueryFilter
|
||||
|
||||
if ($this->allowPinContent()) {
|
||||
$this->fetchScheduledContent();
|
||||
} else {
|
||||
$this->streamQuery->stateFilterCondition[] = ['content.state' => Content::STATE_SCHEDULED];
|
||||
} elseif (!Yii::$app->user->isGuest) {
|
||||
$this->streamQuery->stateFilterCondition[] = $this->getScheduledCondition();
|
||||
}
|
||||
}
|
||||
|
||||
private function getScheduledCondition(): array
|
||||
{
|
||||
return ['AND',
|
||||
['content.state' => Content::STATE_SCHEDULED],
|
||||
['content.created_by' => Yii::$app->user->id]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function fetchScheduledContent(): void
|
||||
{
|
||||
$scheduledQuery = clone $this->query;
|
||||
$scheduledQuery->andWhere([
|
||||
'AND', ['content.state' => Content::STATE_SCHEDULED],
|
||||
['content.created_by' => Yii::$app->user->id]]
|
||||
);
|
||||
$scheduledQuery->andWhere($this->getScheduledCondition());
|
||||
$scheduledQuery->limit(100);
|
||||
$this->scheduledContent = $scheduledQuery->all();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user