Show <activity:subject> and no activity actors for user feed

We only need one author for user feeds: the user themselves. So, show
the user as the activity:subject, and don't repeat the same
activity:actor for every notice unnecessarily.
This commit is contained in:
Evan Prodromou 2010-03-02 02:54:52 -05:00
parent 2c677e0f2d
commit c25fc8a4b5
3 changed files with 29 additions and 6 deletions

View File

@ -1090,7 +1090,7 @@ class Notice extends Memcached_DataObject
return $groups; return $groups;
} }
function asAtomEntry($namespace=false, $source=false) function asAtomEntry($namespace=false, $source=false, $author=true)
{ {
$profile = $this->getProfile(); $profile = $this->getProfile();
@ -1136,8 +1136,10 @@ class Notice extends Memcached_DataObject
$xs->element('title', null, $this->content); $xs->element('title', null, $this->content);
$xs->element('summary', null, $this->content); $xs->element('summary', null, $this->content);
$xs->raw($profile->asAtomAuthor()); if ($author) {
$xs->raw($profile->asActivityActor()); $xs->raw($profile->asAtomAuthor());
$xs->raw($profile->asActivityActor());
}
$xs->element('link', array('rel' => 'alternate', $xs->element('link', array('rel' => 'alternate',
'type' => 'text/html', 'type' => 'text/html',

View File

@ -107,9 +107,19 @@ class AtomNoticeFeed extends Atom10Feed
*/ */
function addEntryFromNotice($notice) function addEntryFromNotice($notice)
{ {
$this->addEntryRaw($notice->asAtomEntry()); $source = $this->showSource();
$author = $this->showAuthor();
$this->addEntryRaw($notice->asAtomEntry(false, $source, $author));
} }
function showSource()
{
return true;
}
function showAuthor()
{
return true;
}
} }

View File

@ -61,6 +61,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
if (!empty($user)) { if (!empty($user)) {
$profile = $user->getProfile(); $profile = $user->getProfile();
$this->addAuthor($profile->nickname, $user->uri); $this->addAuthor($profile->nickname, $user->uri);
$this->setActivitySubject($profile->asActivityNoun('subject'));
} }
} }
@ -68,4 +69,14 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
{ {
return $this->user; return $this->user;
} }
function showSource()
{
return false;
}
function showAuthor()
{
return false;
}
} }