Skip to content

Commit 3786686

Browse files
authored
Merge pull request #135 from humhub-contrib/fix/174-comment-url
[v1.16] Fix gallery comment URL from notifications
2 parents e107cf7 + 1a674ae commit 3786686

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

docs/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
1.5.6 (Unreleased)
5+
-------------------------
6+
- Fix #135: Fix gallery comment URL from notifications
7+
48
1.5.5 (December 22, 2023)
59
-------------------------
610
- Fix #129: Initialize module content class

helpers/Url.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ public static function toGalleryOverview(ContentContainerActiveRecord $container
1313
return $container->createUrl('/gallery/list');
1414
}
1515

16-
public static function toCustomGallery(ContentContainerActiveRecord $container, $gid)
16+
public static function toCustomGallery(ContentContainerActiveRecord $container, $gid, $commentId = null): string
1717
{
18-
return $container->createUrl('/gallery/custom-gallery', ['gid' => $gid]);
18+
$params = ['gid' => $gid];
19+
20+
if ($commentId !== null) {
21+
$params['StreamQuery[commentId]'] = $commentId;
22+
}
23+
24+
return $container->createUrl('/gallery/custom-gallery', $params);
1925
}
2026

2127
public static function toCreateCustomGallery(ContentContainerActiveRecord $container)
@@ -69,4 +75,4 @@ public static function toUploadMedia(ContentContainerActiveRecord $contentContai
6975
}
7076

7177

72-
}
78+
}

models/CustomGallery.php

+14-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
class CustomGallery extends BaseGallery
2020
{
21-
2221
public function getWallUrl()
2322
{
2423
return Url::to(['/content/perma', 'id' => $this->content->id], true);
@@ -29,7 +28,19 @@ public function getUrl()
2928
return Url::toCustomGallery($this->content->container, $this->id);
3029
}
3130

32-
public function isPublic() {
31+
/**
32+
* Return a page with comments because it is not displayed on stream
33+
*
34+
* @param int $id
35+
* @return string
36+
*/
37+
public function getCommentUrl(int $id): string
38+
{
39+
return Url::toCustomGallery($this->content->container, $this->id, $id);
40+
}
41+
42+
public function isPublic()
43+
{
3344
return $this->content->isPublic();
3445
}
3546

@@ -83,7 +94,7 @@ public function getMetaData()
8394
{
8495
$result = parent::getMetaData();
8596
$result['deleteUrl'] = Url::toDeleteCustomGallery($this->content->container, $this->id);
86-
$result['editUrl'] = Url::toEditCustomGallery( $this->content->container, $this->id);
97+
$result['editUrl'] = Url::toEditCustomGallery($this->content->container, $this->id);
8798
$result['imagePadding'] = $this->isEmpty();
8899
return $result;
89100
}

module.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"name": "Gallery",
44
"description": "Adds galleries to Spaces and profiles.",
55
"keywords": ["gallery", "photo", "organisation"],
6-
"version": "1.5.5",
6+
"version": "1.5.6",
77
"humhub": {
8-
"minVersion": "1.14"
8+
"minVersion": "1.16"
99
},
1010
"homepage": "https://github.com/humhub-contrib/gallery",
1111
"authors": [

0 commit comments

Comments
 (0)