diff --git a/src/Controller/DiscussionFeedController.php b/src/Controller/DiscussionFeedController.php index a3b9161..5538ddc 100644 --- a/src/Controller/DiscussionFeedController.php +++ b/src/Controller/DiscussionFeedController.php @@ -101,7 +101,9 @@ protected function getFeedContent(Request $request) 'content' => $this->summarize($this->stripHTML($post->attributes->contentHtml)), 'permalink' => $this->url->to('forum')->route('discussion', ['id' => $discussion->id . '-' . $discussion->attributes->slug, 'near' => $post->attributes->number]) . '/' . $post->attributes->number, // TODO check out why the near parameter refuses to work 'pubdate' => $this->parseDate($post->attributes->createdAt), - 'author' => $this->getRelationship($posts, $post->relationships->user)->username + 'author' => ($post->relationships->user !== null) + ? $this->getRelationship($posts, $post->relationships->user)->username + : $this->translator->trans('core.lib.username.deleted_text') ]; $modified = $this->parseDate($post->attributes->editedAt || $post->attributes->createdAt); diff --git a/src/Controller/DiscussionsActivityFeedController.php b/src/Controller/DiscussionsActivityFeedController.php index 0937559..49deeaa 100644 --- a/src/Controller/DiscussionsActivityFeedController.php +++ b/src/Controller/DiscussionsActivityFeedController.php @@ -137,13 +137,22 @@ protected function getFeedContent(Request $request) $content->contentHtml = ''; } + $userRelation = null; + if($this->lastTopics && isset($discussion->relationships->user)) { + $userRelation = $discussion->relationships->user; + } elseif (isset($discussion->relationships->lastPostedUser)) { + $userRelation = $discussion->relationships->lastPostedUser; + } + $entries[] = [ 'title' => $discussion->attributes->title, 'content' => $this->summarize($this->stripHTML($content->contentHtml)), 'id' => $this->url->to('forum')->route('discussion', ['id' => $discussion->id . '-' . $discussion->attributes->slug]), 'permalink' => $this->url->to('forum')->route('discussion', ['id' => $discussion->id . '-' . $discussion->attributes->slug, 'near' => $content->number]) . '/' . $content->number, // TODO same than DiscussionFeedController 'pubdate' => $this->parseDate($this->lastTopics ? $discussion->attributes->createdAt : $discussion->attributes->lastPostedAt), - 'author' => $this->getRelationship($last_discussions, $this->lastTopics ? $discussion->relationships->user : $discussion->relationships->lastPostedUser)->username + 'author' => $userRelation !== null + ? $this->getRelationship($last_discussions, $userRelation)->username + : $this->translator->trans('core.lib.username.deleted_text') ]; $modified = $this->parseDate($this->lastTopics ? $discussion->attributes->createdAt : $discussion->attributes->lastPostedAt); diff --git a/views/atom.blade.php b/views/atom.blade.php index 63c294d..c06de23 100644 --- a/views/atom.blade.php +++ b/views/atom.blade.php @@ -20,7 +20,7 @@ type="html" @endif> - {{ $entry['author'] }} + @endforeach