Skip to content

Commit

Permalink
Merge 3300a24 into f58a6d9
Browse files Browse the repository at this point in the history
  • Loading branch information
willdoran committed Oct 25, 2018
2 parents f58a6d9 + 3300a24 commit 6a4717f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
12 changes: 11 additions & 1 deletion app/Http/Controllers/API/Posts/GeoJSONController.php
Expand Up @@ -73,11 +73,21 @@ public function index(Request $request)
*/
public function show(Request $request)
{
$isDemoTier = service('site.config')['tier'] === 'demo_1';
$identifiers = $this->getIdentifiers($request);
if ($isDemoTier) {
// Demo deployments are limited to the first 25 posts,
// if any thing other more than that or a different offset is request
// none will be returned
$identifiers['limit'] = $identifiers['offset'] > 0 ? 0 : 25;
$identifiers['offset'] = 0;
}

$this->prepBoundingBox($request);

$this->usecase = $this->usecaseFactory
->get($this->getResource(), 'read')
->setIdentifiers($this->getIdentifiers($request))
->setIdentifiers($identifiers)
->setFormatter(service('formatter.entity.post.geojson'));

return $this->prepResponse($this->executeUsecase($request), $request);
Expand Down
13 changes: 12 additions & 1 deletion app/Http/Controllers/API/Posts/PostsController.php
Expand Up @@ -101,9 +101,20 @@ public function index(Request $request)
*/
public function show(Request $request)
{

$isDemoTier = service('site.config')['tier'] === 'demo_1';
$identifiers = $this->getIdentifiers($request);
if ($isDemoTier) {
// Demo deployments are limited to the first 25 posts,
// if any thing other more than that or a different offset is request
// none will be returned
$identifiers['limit'] = $identifiers['offset'] > 0 ? 0 : 25;
$identifiers['offset'] = 0;
}

$this->usecase = $this->usecaseFactory
->get($this->getResource(), 'read')
->setIdentifiers($this->getIdentifiers($request));
->setIdentifiers($identifiers);

return $this->prepResponse($this->executeUsecase($request), $request);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/CheckDemoExpiration.php
Expand Up @@ -18,7 +18,7 @@ class CheckDemoExpiration
public function handle($request, Closure $next, $guard = null)
{
$multisite = config('multisite.enabled');
$isDemoTier = service('site.config')['tier'] === 'demo';
$isDemoTier = service('site.config')['tier'] === 'demo_1';
$isNotGet = !$request->isMethod('get');

if ($multisite && $isNotGet && $isDemoTier) {
Expand Down
4 changes: 2 additions & 2 deletions docs/api/config.apib
Expand Up @@ -60,7 +60,7 @@
"date_format": "n/j/Y",
"client_url": false,
"first_login": true,
"tier": "free",
"tier": "demo_1",
"private": false,
"allowed_privileges": [
"read",
Expand Down Expand Up @@ -188,7 +188,7 @@
"date_format": "n/j/Y",
"client_url": false,
"first_login": true,
"tier": "free",
"tier": "demo_1",
"private": false,
"allowed_privileges": [
"read",
Expand Down
2 changes: 1 addition & 1 deletion src/App/Repository/Config/site.php
Expand Up @@ -33,6 +33,6 @@
'date_format' => 'n/j/Y',
'client_url' => false,
'first_login' => true,
'tier' => 'free',
'tier' => 'demo_1',
'private' => false,
];

0 comments on commit 6a4717f

Please sign in to comment.