From 75079320d18d344ac73dea41eb58bc34548b9a01 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 9 Apr 2017 12:13:53 +0200 Subject: [PATCH] Give remote Atom URL for remote profile view --- actions/showstream.php | 17 +++++++++++++---- classes/Profile.php | 7 +++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/actions/showstream.php b/actions/showstream.php index 1e70ecd3ac..6fe9451633 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -113,6 +113,18 @@ class ShowstreamAction extends NoticestreamAction $this->target->getNickname(), $this->tag))); } + if (!$this->target->isLocal()) { + // remote profiles at least have Atom, but we can't guarantee anything else + return array( + new Feed(Feed::ATOM, + $this->target->getAtomFeed(), + // TRANS: Title for link to notice feed. + // TRANS: %s is a user nickname. + sprintf(_('Notice feed for %s (Atom)'), + $this->target->getNickname())) + ); + } + return array(new Feed(Feed::JSON, common_local_url('ApiTimelineUser', array( @@ -139,10 +151,7 @@ class ShowstreamAction extends NoticestreamAction sprintf(_('Notice feed for %s (RSS 2.0)'), $this->target->getNickname())), new Feed(Feed::ATOM, - common_local_url('ApiTimelineUser', - array( - 'id' => $this->target->getID(), - 'format' => 'atom')), + $this->target->getAtomFeed(), // TRANS: Title for link to notice feed. // TRANS: %s is a user nickname. sprintf(_('Notice feed for %s (Atom)'), diff --git a/classes/Profile.php b/classes/Profile.php index d076203a8d..ee050dfb4f 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -1618,14 +1618,13 @@ class Profile extends Managed_DataObject return !empty($block); } - function getAtomFeed() + public function getAtomFeed() { $feed = null; if (Event::handle('StartProfileGetAtomFeed', array($this, &$feed))) { - $user = User::getKV('id', $this->id); - if (!empty($user)) { - $feed = common_local_url('ApiTimelineUser', array('id' => $user->id, + if ($this->isLocal()) { + $feed = common_local_url('ApiTimelineUser', array('id' => $this->getID(), 'format' => 'atom')); } Event::handle('EndProfileGetAtomFeed', array($this, $feed)); -- 2.39.5