summaryrefslogtreecommitdiff
path: root/classes/Notice.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-08-03 15:50:21 -0700
committerEvan Prodromou <evan@status.net>2010-08-03 15:50:21 -0700
commitf83171824f835ff9cd24bf0aea26f13c62b806cf (patch)
treef66e01184387b1afa454794f4ad6af318ef3759d /classes/Notice.php
parent744233c6dc385a5870652ab70e7141e75aaff783 (diff)
correctly show <source> for atom feeds
Diffstat (limited to 'classes/Notice.php')
-rw-r--r--classes/Notice.php48
1 files changed, 32 insertions, 16 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index f6e9eb585..61844d487 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -1215,29 +1215,45 @@ class Notice extends Memcached_DataObject
if ($source) {
- $xs->elementStart('source');
+ $atom_feed = $profile->getAtomFeed();
- $xs->element('id', null, $profile->profileurl);
- $xs->element('title', null, $profile->nickname . " - " . common_config('site', 'name'));
- $xs->element('link', array('href' => $profile->profileurl));
+ if (!empty($atom_feed)) {
- $user = User::staticGet('id', $profile->id);
+ $xs->elementStart('source');
+
+ // XXX: we should store the actual feed ID
+
+ $xs->element('id', null, $atom_feed);
+
+ // XXX: we should store the actual feed title
+
+ $xs->element('title', null, $profile->getBestName());
+
+ $xs->element('link', array('rel' => 'alternate',
+ 'type' => 'text/html',
+ 'href' => $profile->profileurl));
- if (!empty($user)) {
- $atom_feed = common_local_url('ApiTimelineUser',
- array('format' => 'atom',
- 'id' => $profile->nickname));
$xs->element('link', array('rel' => 'self',
'type' => 'application/atom+xml',
- 'href' => $profile->profileurl));
- $xs->element('link', array('rel' => 'license',
- 'href' => common_config('license', 'url')));
- }
+ 'href' => $atom_feed));
- $xs->element('icon', null, $profile->avatarUrl(AVATAR_PROFILE_SIZE));
- $xs->element('updated', null, common_date_w3dtf($this->created)); // FIXME: not true!
+ $xs->element('icon', null, $profile->avatarUrl(AVATAR_PROFILE_SIZE));
- $xs->elementEnd('source');
+ $notice = $profile->getCurrentNotice();
+
+ if (!empty($notice)) {
+ $xs->element('updated', null, common_date_w3dtf($notice->created));
+ }
+
+ $user = User::staticGet('id', $profile->id);
+
+ if (!empty($user)) {
+ $xs->element('link', array('rel' => 'license',
+ 'href' => common_config('license', 'url')));
+ }
+
+ $xs->elementEnd('source');
+ }
}
Event::handle('EndActivitySource', array(&$this, &$xs));
}