Skip to content

Commit

Permalink
Display only published contents
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed May 1, 2024
1 parent 58702a5 commit 0ad9e21
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions components/ActiveQueryReportContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace humhub\modules\reportcontent\components;

use humhub\modules\content\components\ContentContainerActiveRecord;
use humhub\modules\content\models\Content;
use Yii;
use yii\db\ActiveQuery;
use yii\db\Expression;
Expand All @@ -24,9 +25,10 @@ public function readable(?ContentContainerActiveRecord $container = null): self
$this->andWhere(['system_admin_only' => 0]);
}

$this->joinWith('content')->andWhere(['content.state' => Content::STATE_PUBLISHED]);

if ($container !== null) {
$this->joinWith('content')
->andWhere(['content.contentcontainer_id' => $container->contentcontainer_id])
$this->andWhere(['content.contentcontainer_id' => $container->contentcontainer_id])
->andWhere(['not', ['content.created_by' => Yii::$app->user->id]]);
}

Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.1.0 (Unreleased)
----------------------
- Fix #75: Display only published contents

1.0.4 (Unreleased)
----------------------
- Enh #71: Tests for `next` version
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"profanity filter",
"abuse"
],
"version": "1.0.4",
"version": "1.1.0",
"authors": [
{
"name": "HumHub Staff"
Expand All @@ -21,7 +21,7 @@
"homepage": "https://github.com/humhub/reportcontent",
"license": "AGPL-3.0-or-later",
"humhub": {
"minVersion": "1.13"
"minVersion": "1.14"
},
"screenshots": ["resources/screen1.PNG", "resources/screen2.PNG", "resources/screen3.PNG", "resources/screen4.PNG", "resources/screen5.PNG"]
}

0 comments on commit 0ad9e21

Please sign in to comment.