Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
feat: launch on Humhub 1.7
Browse files Browse the repository at this point in the history
Rewritten `\tracker\controllers\actions\StreamAction` for new requirements

Closes #40
  • Loading branch information
githubjeka committed Nov 11, 2020
1 parent ff65e80 commit 7102255
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
5 changes: 0 additions & 5 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ class Module extends ContentContainerModule
public $id = 'tracker-issues';

public $documentRootPath;

/**
* @inheritdoc
*/
public $resourcesPath = 'resources';

public function init()
{
Expand Down
33 changes: 15 additions & 18 deletions controllers/actions/StreamAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,7 @@
*/
class StreamAction extends ContentContainerStream
{
public $streamQueryClass = IssueWallStreamQuery::class;

public function setupFilters()
{
if (!empty($this->streamQuery->contentId) && \Yii::$app->user->permissionmanager->can(new ViewAllDocuments())) {
$tableIssue = Issue::tableName();
$documentsIssuesTable = DocumentIssue::tableName();
$this->streamQuery
->query()
->leftJoin($documentsIssuesTable, "$documentsIssuesTable.issue_id = $tableIssue.id")
->orWhere(
"$documentsIssuesTable.issue_id IS NOT NULL AND content.id = :id",
[':id' => $this->streamQuery->contentId]
);
}
}

public function setupCriteria()
public function afterApplyFilters()
{
if (empty($this->streamQuery->contentId)) {
$this->streamQuery
Expand Down Expand Up @@ -71,6 +54,20 @@ public function setupCriteria()
" OR $tableAssignee.id IS NOT NULL)) ",
[':user' => \Yii::$app->user->id]
);

if (\Yii::$app->user->permissionmanager->can(new ViewAllDocuments())) {
$tableIssue = Issue::tableName();
$documentsIssuesTable = DocumentIssue::tableName();
$this->streamQuery
->query()
->leftJoin($documentsIssuesTable, "$documentsIssuesTable.issue_id = $tableIssue.id")
->orWhere(
"$documentsIssuesTable.issue_id IS NOT NULL AND content.id = :id",
[':id' => $this->streamQuery->contentId]
);
}
}

parent::afterApplyFilters();
}
}
3 changes: 2 additions & 1 deletion views/document/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @author Evgeniy Tkachenko <[email protected]>
*/

use humhub\modules\content\widgets\richtext\RichText;
use tracker\models\Document;
use tracker\models\Link;
use tracker\Module;
Expand Down Expand Up @@ -67,7 +68,7 @@
<legend><?= Html::encode($this->title) ?></legend>
<?php if ($model->description) : ?>
<blockquote>
<?= \humhub\widgets\RichText::widget([
<?= RichText::widget([
'text' => $model->description,
]) ?>
</blockquote>
Expand Down
3 changes: 1 addition & 2 deletions views/issue/__item_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

use humhub\libs\Html;
use humhub\widgets\RichText;
use tracker\widgets\DeadlineIssueWidget;
use tracker\widgets\PriorityIssueWidget;
use tracker\widgets\StatusIssueWidget;
Expand Down Expand Up @@ -46,7 +45,7 @@
['class' => 'mark']
) ?>
<?php endforeach; ?>
<?= RichText::widget(['maxLength' => 150, 'minimal' => true, 'text' => $issue->description,]) ?>
<?= \humhub\modules\content\widgets\richtext\RichText::widget(['maxLength' => 150, 'minimal' => true, 'text' => $issue->description,]) ?>
</div>
<div>
<hr>
Expand Down

0 comments on commit 7102255

Please sign in to comment.