From 0c4f031250aeea7f52668c6a257411a2786fcfac Mon Sep 17 00:00:00 2001 From: buddh4 Date: Sat, 29 Jul 2017 21:42:47 +0200 Subject: [PATCH] Fix #2582 Userfollow activity click action not working Enh: Make space membership activities clickable --- protected/humhub/docs/CHANGELOG.md | 3 +++ .../humhub/modules/activity/components/BaseActivity.php | 1 - .../modules/activity/controllers/LinkController.php | 7 ++----- protected/humhub/modules/space/activities/MemberAdded.php | 6 ------ .../humhub/modules/space/activities/MemberRemoved.php | 5 ----- protected/humhub/modules/user/activities/UserFollow.php | 8 ++++++++ 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/protected/humhub/docs/CHANGELOG.md b/protected/humhub/docs/CHANGELOG.md index c2be706295..c1ea9fde51 100644 --- a/protected/humhub/docs/CHANGELOG.md +++ b/protected/humhub/docs/CHANGELOG.md @@ -48,6 +48,9 @@ HumHub Change Log - Enh: Added `ContentTag` concept for creating content categories/filter on module level - Fix: Mentioning keeps running even if previous input result was empty - Enh: Darkened comment links for better readability +- Fix #2582 Userfollow activity click action not working +- Enh: Make space membership activities clickable + 1.2.1 (June 17, 2017) - Fix: Invite error in french language diff --git a/protected/humhub/modules/activity/components/BaseActivity.php b/protected/humhub/modules/activity/components/BaseActivity.php index ff6918e459..37ca9a8ad5 100644 --- a/protected/humhub/modules/activity/components/BaseActivity.php +++ b/protected/humhub/modules/activity/components/BaseActivity.php @@ -119,7 +119,6 @@ abstract class BaseActivity extends \humhub\components\SocialActivity public function container($container) { $this->record->content->container = $container; - return $this; } diff --git a/protected/humhub/modules/activity/controllers/LinkController.php b/protected/humhub/modules/activity/controllers/LinkController.php index 6f13dbf2da..99ec4ad98d 100644 --- a/protected/humhub/modules/activity/controllers/LinkController.php +++ b/protected/humhub/modules/activity/controllers/LinkController.php @@ -11,8 +11,6 @@ namespace humhub\modules\activity\controllers; use Yii; use humhub\components\Controller; use humhub\modules\activity\models\Activity; -use humhub\modules\content\components\ContentActiveRecord; -use humhub\modules\content\components\ContentAddonActiveRecord; /** * LinkController provides link informations about an Activity via JSON. @@ -43,9 +41,8 @@ class LinkController extends Controller $activityId = Yii::$app->request->get('id'); $activity = Activity::findOne(['id' => $activityId]); - if ($activity !== null && $activity->content->canRead()) { - $source = $activity->getSource(); - $this->redirect($source->content->getUrl()); + if ($activity !== null && $activity->content->canView()) { + $this->redirect($activity->getActivityBaseClass()->getUrl()); } } diff --git a/protected/humhub/modules/space/activities/MemberAdded.php b/protected/humhub/modules/space/activities/MemberAdded.php index 03cfa5fe90..b413f20e16 100644 --- a/protected/humhub/modules/space/activities/MemberAdded.php +++ b/protected/humhub/modules/space/activities/MemberAdded.php @@ -19,12 +19,6 @@ use humhub\modules\activity\interfaces\ConfigurableActivityInterface; */ class MemberAdded extends BaseActivity implements ConfigurableActivityInterface { - - /** - * @inheritdoc - */ - public $clickable = false; - /** * @inheritdoc */ diff --git a/protected/humhub/modules/space/activities/MemberRemoved.php b/protected/humhub/modules/space/activities/MemberRemoved.php index 2b56b667c9..1082e128fa 100644 --- a/protected/humhub/modules/space/activities/MemberRemoved.php +++ b/protected/humhub/modules/space/activities/MemberRemoved.php @@ -20,11 +20,6 @@ use humhub\modules\activity\interfaces\ConfigurableActivityInterface; class MemberRemoved extends BaseActivity implements ConfigurableActivityInterface { - /** - * @inheritdoc - */ - public $clickable = false; - /** * @inheritdoc */ diff --git a/protected/humhub/modules/user/activities/UserFollow.php b/protected/humhub/modules/user/activities/UserFollow.php index 85abbe73c8..9c3f7504f6 100644 --- a/protected/humhub/modules/user/activities/UserFollow.php +++ b/protected/humhub/modules/user/activities/UserFollow.php @@ -28,4 +28,12 @@ class UserFollow extends BaseActivity */ public $viewName = "userFollow"; + /** + * @inheritdoc + */ + public function getUrl() + { + return $this->source->target->getUrl(); + } + }