forked from GNUsocial/gnu-social
Add self link to user and group rss2 feeds
This commit is contained in:
parent
7e1a1506f5
commit
212b20e876
@ -107,6 +107,14 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
|||||||
// We'll pull common formatting out of this for other formats
|
// We'll pull common formatting out of this for other formats
|
||||||
$atom = new AtomGroupNoticeFeed($this->group);
|
$atom = new AtomGroupNoticeFeed($this->group);
|
||||||
|
|
||||||
|
// Calculate self link
|
||||||
|
$id = $this->arg('id');
|
||||||
|
$aargs = array('format' => $this->format);
|
||||||
|
if (!empty($id)) {
|
||||||
|
$aargs['id'] = $id;
|
||||||
|
}
|
||||||
|
$self = $this->getSelfUri('ApiTimelineGroup', $aargs);
|
||||||
|
|
||||||
switch($this->format) {
|
switch($this->format) {
|
||||||
case 'xml':
|
case 'xml':
|
||||||
$this->showXmlTimeline($this->notices);
|
$this->showXmlTimeline($this->notices);
|
||||||
@ -118,7 +126,8 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
|||||||
$this->group->homeUrl(),
|
$this->group->homeUrl(),
|
||||||
$atom->subtitle,
|
$atom->subtitle,
|
||||||
null,
|
null,
|
||||||
$atom->logo
|
$atom->logo,
|
||||||
|
$self
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
@ -126,24 +135,12 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
|||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$atom->addAuthorRaw($this->group->asAtomAuthor());
|
$atom->addAuthorRaw($this->group->asAtomAuthor());
|
||||||
$atom->setActivitySubject($this->group->asActivitySubject());
|
$atom->setActivitySubject($this->group->asActivitySubject());
|
||||||
|
|
||||||
$id = $this->arg('id');
|
|
||||||
$aargs = array('format' => 'atom');
|
|
||||||
if (!empty($id)) {
|
|
||||||
$aargs['id'] = $id;
|
|
||||||
}
|
|
||||||
$self = $this->getSelfUri('ApiTimelineGroup', $aargs);
|
|
||||||
|
|
||||||
$atom->setId($self);
|
$atom->setId($self);
|
||||||
$atom->setSelfLink($self);
|
$atom->setSelfLink($self);
|
||||||
|
|
||||||
$atom->addEntryFromNotices($this->notices);
|
$atom->addEntryFromNotices($this->notices);
|
||||||
|
|
||||||
$this->raw($atom->getString());
|
$this->raw($atom->getString());
|
||||||
|
|
||||||
} catch (Atom10FeedException $e) {
|
} catch (Atom10FeedException $e) {
|
||||||
$this->serverError(
|
$this->serverError(
|
||||||
'Could not generate feed for group - ' . $e->getMessage()
|
'Could not generate feed for group - ' . $e->getMessage()
|
||||||
|
@ -116,13 +116,19 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
|||||||
// We'll use the shared params from the Atom stub
|
// We'll use the shared params from the Atom stub
|
||||||
// for other feed types.
|
// for other feed types.
|
||||||
$atom = new AtomUserNoticeFeed($this->user);
|
$atom = new AtomUserNoticeFeed($this->user);
|
||||||
$title = $atom->title;
|
|
||||||
$link = common_local_url(
|
$link = common_local_url(
|
||||||
'showstream',
|
'showstream',
|
||||||
array('nickname' => $this->user->nickname)
|
array('nickname' => $this->user->nickname)
|
||||||
);
|
);
|
||||||
$subtitle = $atom->subtitle;
|
|
||||||
$logo = $atom->logo;
|
// Calculate self link
|
||||||
|
$id = $this->arg('id');
|
||||||
|
$aargs = array('format' => $this->format);
|
||||||
|
if (!empty($id)) {
|
||||||
|
$aargs['id'] = $id;
|
||||||
|
}
|
||||||
|
$self = $this->getSelfUri('ApiTimelineUser', $aargs);
|
||||||
|
|
||||||
// FriendFeed's SUP protocol
|
// FriendFeed's SUP protocol
|
||||||
// Also added RSS and Atom feeds
|
// Also added RSS and Atom feeds
|
||||||
@ -136,25 +142,22 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
|||||||
break;
|
break;
|
||||||
case 'rss':
|
case 'rss':
|
||||||
$this->showRssTimeline(
|
$this->showRssTimeline(
|
||||||
$this->notices, $title, $link,
|
$this->notices,
|
||||||
$subtitle, $suplink, $logo
|
$atom->title,
|
||||||
|
$link,
|
||||||
|
$atom->subtitle,
|
||||||
|
$suplink,
|
||||||
|
$atom->logo,
|
||||||
|
$self
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
|
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
$id = $this->arg('id');
|
|
||||||
$aargs = array('format' => 'atom');
|
|
||||||
if (!empty($id)) {
|
|
||||||
$aargs['id'] = $id;
|
|
||||||
}
|
|
||||||
$self = $this->getSelfUri('ApiTimelineUser', $aargs);
|
|
||||||
$atom->setId($self);
|
$atom->setId($self);
|
||||||
$atom->setSelfLink($self);
|
$atom->setSelfLink($self);
|
||||||
|
|
||||||
$atom->addEntryFromNotices($this->notices);
|
$atom->addEntryFromNotices($this->notices);
|
||||||
|
|
||||||
$this->raw($atom->getString());
|
$this->raw($atom->getString());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user