Merge pull request #7115 from nupplaphil/bug/mod_contact_batch

Add contact/batch route
This commit is contained in:
Hypolite Petovan 2019-05-07 15:22:46 -04:00 committed by GitHub
commit dcd602d02a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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;