forked from GNUsocial/gnu-social
Fixed routing for direct messages and favorites in the API
This commit is contained in:
parent
673e7d2559
commit
5e816d7be2
@ -226,20 +226,31 @@ class Router
|
|||||||
|
|
||||||
// direct messages
|
// direct messages
|
||||||
|
|
||||||
$m->connect('api/direct_messages/:method',
|
foreach (array('xml', 'json') as $e) {
|
||||||
array('action' => 'api',
|
$m->connect('api/direct_messages/new.'.$e,
|
||||||
'apiaction' => 'direct_messages'),
|
array('action' => 'api',
|
||||||
array('method' => '(sent|new)(\.(xml|json|atom|rss))?'));
|
'apiaction' => 'direct_messages',
|
||||||
|
'method' => 'create.'.$e));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (array('xml', 'json', 'rss', 'atom') as $e) {
|
||||||
|
$m->connect('api/direct_messages.'.$e,
|
||||||
|
array('action' => 'api',
|
||||||
|
'apiaction' => 'direct_messages',
|
||||||
|
'method' => 'direct_messages.'.$e));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (array('xml', 'json', 'rss', 'atom') as $e) {
|
||||||
|
$m->connect('api/direct_message/sent.'.$e,
|
||||||
|
array('action' => 'api',
|
||||||
|
'apiaction' => 'direct_messages',
|
||||||
|
'method' => 'sent.'.$e));
|
||||||
|
}
|
||||||
|
|
||||||
$m->connect('api/direct_messages/destroy/:argument',
|
$m->connect('api/direct_messages/destroy/:argument',
|
||||||
array('action' => 'api',
|
array('action' => 'api',
|
||||||
'apiaction' => 'direct_messages'));
|
'apiaction' => 'direct_messages'));
|
||||||
|
|
||||||
$m->connect('api/:method',
|
|
||||||
array('action' => 'api',
|
|
||||||
'apiaction' => 'direct_messages'),
|
|
||||||
array('method' => 'direct_messages(\.(xml|json|atom|rss))?'));
|
|
||||||
|
|
||||||
// friendships
|
// friendships
|
||||||
|
|
||||||
$m->connect('api/friendships/:method/:argument',
|
$m->connect('api/friendships/:method/:argument',
|
||||||
@ -269,10 +280,12 @@ class Router
|
|||||||
'apiaction' => 'favorites',
|
'apiaction' => 'favorites',
|
||||||
'method' => 'favorites'));
|
'method' => 'favorites'));
|
||||||
|
|
||||||
$m->connect('api/:method',
|
foreach (array('xml', 'json', 'rss', 'atom') as $e) {
|
||||||
array('action' => 'api',
|
$m->connect('api/favorites.'.$e,
|
||||||
'apiaction' => 'favorites'),
|
array('action' => 'api',
|
||||||
array('method' => 'favorites(\.(xml|json|rss|atom))?'));
|
'apiaction' => 'favorites',
|
||||||
|
'method' => 'favorites.'.$e));
|
||||||
|
}
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
|
|
||||||
@ -345,7 +358,16 @@ class Router
|
|||||||
|
|
||||||
function map($path)
|
function map($path)
|
||||||
{
|
{
|
||||||
return $this->m->match($path);
|
try {
|
||||||
|
$match = $this->m->match($path);
|
||||||
|
} catch (Net_URL_Mapper_InvalidException $e) {
|
||||||
|
common_log(LOG_ERR, "Problem getting route for $path - " .
|
||||||
|
$e->getMessage());
|
||||||
|
$cac = new ClientErrorAction("Page not found.", 404);
|
||||||
|
$cac->showPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $match;
|
||||||
}
|
}
|
||||||
|
|
||||||
function build($action, $args=null, $fragment=null)
|
function build($action, $args=null, $fragment=null)
|
||||||
|
Loading…
Reference in New Issue
Block a user