Skip to content

Commit

Permalink
Fix gallery comment URL from notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Mar 18, 2024
1 parent e107cf7 commit 1a674ae
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
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.5.6 (Unreleased)
-------------------------
- Fix #135: Fix gallery comment URL from notifications

1.5.5 (December 22, 2023)
-------------------------
- Fix #129: Initialize module content class
Expand Down
12 changes: 9 additions & 3 deletions helpers/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ public static function toGalleryOverview(ContentContainerActiveRecord $container
return $container->createUrl('/gallery/list');
}

public static function toCustomGallery(ContentContainerActiveRecord $container, $gid)
public static function toCustomGallery(ContentContainerActiveRecord $container, $gid, $commentId = null): string
{
return $container->createUrl('/gallery/custom-gallery', ['gid' => $gid]);
$params = ['gid' => $gid];

if ($commentId !== null) {
$params['StreamQuery[commentId]'] = $commentId;
}

return $container->createUrl('/gallery/custom-gallery', $params);
}

public static function toCreateCustomGallery(ContentContainerActiveRecord $container)
Expand Down Expand Up @@ -69,4 +75,4 @@ public static function toUploadMedia(ContentContainerActiveRecord $contentContai
}


}
}
17 changes: 14 additions & 3 deletions models/CustomGallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
class CustomGallery extends BaseGallery
{

public function getWallUrl()
{
return Url::to(['/content/perma', 'id' => $this->content->id], true);
Expand All @@ -29,7 +28,19 @@ public function getUrl()
return Url::toCustomGallery($this->content->container, $this->id);
}

public function isPublic() {
/**
* Return a page with comments because it is not displayed on stream
*
* @param int $id
* @return string
*/
public function getCommentUrl(int $id): string
{
return Url::toCustomGallery($this->content->container, $this->id, $id);
}

public function isPublic()
{
return $this->content->isPublic();
}

Expand Down Expand Up @@ -83,7 +94,7 @@ public function getMetaData()
{
$result = parent::getMetaData();
$result['deleteUrl'] = Url::toDeleteCustomGallery($this->content->container, $this->id);
$result['editUrl'] = Url::toEditCustomGallery( $this->content->container, $this->id);
$result['editUrl'] = Url::toEditCustomGallery($this->content->container, $this->id);
$result['imagePadding'] = $this->isEmpty();
return $result;
}
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"name": "Gallery",
"description": "Adds galleries to Spaces and profiles.",
"keywords": ["gallery", "photo", "organisation"],
"version": "1.5.5",
"version": "1.5.6",
"humhub": {
"minVersion": "1.14"
"minVersion": "1.16"
},
"homepage": "https://github.com/humhub-contrib/gallery",
"authors": [
Expand Down

0 comments on commit 1a674ae

Please sign in to comment.