Add contact/batch route

This commit is contained in:
Philipp Holzer 2019-05-07 21:15:22 +02:00
parent 3785c6de05
commit 9ff0d56e03
No known key found for this signature in database
GPG Key ID: 517BE60E2CE5C8A5
2 changed files with 4 additions and 1 deletions

View File

@ -92,7 +92,7 @@ class Router
$this->routeCollector->addRoute(['GET'], '/bookmarklet', Module\Bookmarklet::class);
$this->routeCollector->addGroup('/contact', function (RouteCollector $collector) {
$collector->addRoute(['GET'], '[/]', Module\Contact::class);
$collector->addRoute(['GET'], '/{id:\d+}[/]', Module\Contact::class);
$collector->addRoute(['GET', 'POST'], '/{id:\d+}[/]', Module\Contact::class);
$collector->addRoute(['GET'], '/{id:\d+}/archive', Module\Contact::class);
$collector->addRoute(['GET'], '/{id:\d+}/block', Module\Contact::class);
$collector->addRoute(['GET'], '/{id:\d+}/conversations', Module\Contact::class);
@ -103,6 +103,7 @@ class Router
$collector->addRoute(['GET'], '/{id:\d+}/updateprofile', Module\Contact::class);
$collector->addRoute(['GET'], '/all', Module\Contact::class);
$collector->addRoute(['GET'], '/archived', Module\Contact::class);
$collector->addRoute(['GET', 'POST'], '/batch', Module\Contact::class);
$collector->addRoute(['GET'], '/blocked', Module\Contact::class);
$collector->addRoute(['GET'], '/hidden', Module\Contact::class);
$collector->addRoute(['GET'], '/ignored', Module\Contact::class);

View File

@ -177,11 +177,13 @@ class Contact extends BaseModule
return;
}
// @TODO: Replace with parameter from router
if ($a->argv[1] === 'batch') {
self::batchActions($a);
return;
}
// @TODO: Replace with parameter from router
$contact_id = intval($a->argv[1]);
if (!$contact_id) {
return;