We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit dfa955bf authored by Zach Copley's avatar Zach Copley

- Output entity tag

- More comments for function blocks
parent ccc7caf9
......@@ -76,11 +76,27 @@ class ApiFriendsTimelineAction extends ApiBareAuthAction
return true;
}
/**
* Handle the request
*
* Just show the notices
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args) {
parent::handle($args);
$this->showTimeline();
}
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
......@@ -124,6 +140,12 @@ class ApiFriendsTimelineAction extends ApiBareAuthAction
}
}
/**
* Get notices
*
* @return array notices
*/
function getNotices()
{
$notices = array();
......@@ -163,15 +185,37 @@ class ApiFriendsTimelineAction extends ApiBareAuthAction
function lastModified()
{
if (empty($this->notices)) {
return null;
if (!empty($this->notices) && (count($this->notices) > 0)) {
return strtotime($this->notices[0]->created);
}
if (count($this->notices) == 0) {
return null;
return null;
}
/**
* An entity tag for this page
*
* Returns an Etag based on the action name, language, user ID, and
* timestamps of the first and last notice in the timeline
*
* @return string etag
*/
function etag()
{
if (!empty($this->notices) && (count($this->notices) > 0)) {
$last = count($this->notices) - 1;
return implode(':',
array($this->arg('action'),
common_language(),
$this->user->id,
strtotime($this->notices[0]->created),
strtotime($this->notices[$last]->created))) . '"';
}
return strtotime($this->notices[0]->created);
return null;
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment