Skip to content

Commit

Permalink
Update method of checking friendship humhub/humhub#6745
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-rueegg committed Jan 17, 2024
1 parent 3290dca commit 05c50a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion models/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use humhub\modules\file\libs\FileHelper;
use humhub\modules\file\models\File as BaseFile;
use humhub\modules\file\models\FileUpload;
use humhub\modules\friendship\Module as FriendshipModule;
use humhub\modules\search\events\SearchAddEvent;
use humhub\modules\topic\models\Topic;
use Yii;
Expand Down Expand Up @@ -215,7 +216,8 @@ public function updateVisibility($visibility)

public function getVisibilityTitle()
{
if(Yii::$app->getModule('friendship')->getIsEnabled() && $this->content->container instanceof User) {
$module = Yii::$app->getModule('friendship');
if($module instanceof FriendshipModule && $module->isFriendshipEnabled() && $this->content->container instanceof User) {
if($this->content->container->isCurrentuser()) {
$privateText = Yii::t('CfilesModule.base', 'This file is only visible for you and your friends.');
} else {
Expand Down
4 changes: 3 additions & 1 deletion models/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use humhub\modules\file\libs\ImageHelper;
use humhub\modules\file\models\FileContent;
use humhub\modules\file\libs\FileHelper;
use humhub\modules\friendship\Module as FriendshipModule;
use humhub\modules\user\models\User;
use humhub\modules\search\events\SearchAddEvent;
use humhub\modules\space\models\Space;
Expand Down Expand Up @@ -281,7 +282,8 @@ public function beforeDelete()

public function getVisibilityTitle()
{
if (Yii::$app->getModule('friendship')->getIsEnabled() && $this->content->container instanceof User) {
$module = Yii::$app->getModule('friendship');
if ($module instanceof FriendshipModule && $module->isFriendshipEnabled() && $this->content->container instanceof User) {
if ($this->content->container->isCurrentuser()) {
$privateText = Yii::t('CfilesModule.base', 'This folder is only visible for you and your friends.');
} else {
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"version": "0.16.3",
"humhub": {
"minVersion": "1.14"
"minVersion": "1.16"
},
"homepage": "https://github.com/humhub/cfiles",
"authors": [
Expand Down

0 comments on commit 05c50a0

Please sign in to comment.