mirror of
https://github.com/humhub/humhub.git
synced 2025-01-29 12:28:06 +01:00
Fixed: Activity link when no wall entry is available
This commit is contained in:
parent
056ae54a15
commit
43d1360d07
@ -52,14 +52,16 @@ class LinkController extends Controller
|
||||
|
||||
if ($activity !== null && $activity->content->canRead()) {
|
||||
$json['success'] = 'true';
|
||||
$json['wallEntryId'] = '';
|
||||
$json['wallEntryId'] = '0';
|
||||
|
||||
$source = $activity->getSource();
|
||||
if ($source instanceof ContentActiveRecord || $source instanceof ContentAddonActiveRecord) {
|
||||
$json['wallEntryId'] = $source->content->getFirstWallEntryId();
|
||||
$json['permaLink'] = $source->content->getUrl();
|
||||
} else {
|
||||
$json['permaLink'] = $activity->content->getUrl();
|
||||
}
|
||||
|
||||
$json['permaLink'] = $activity->content->getUrl();
|
||||
}
|
||||
|
||||
return $json;
|
||||
|
@ -5,10 +5,11 @@ function activityShowItem(activityId) {
|
||||
|
||||
$.getJSON(activityInfoUrl.replace('-id-', activityId), function (data) {
|
||||
if (data.success) {
|
||||
if (mainStream) {
|
||||
console.log(data);
|
||||
if (typeof mainStream !== "undefined" && data['wallEntryId'] != 0) {
|
||||
mainStream.showItem(data['wallEntryId']);
|
||||
} else {
|
||||
window.location.replace(data['url']);
|
||||
window.location.replace(data['permaLink']);
|
||||
}
|
||||
} else {
|
||||
alert("Error: Could not find activity location!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user