Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix include_unstructured_posts to accept false value #4925

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Ushahidi/Modules/V5/DTO/PostSearchFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ public function __construct(Request $request)
$this->parent = $this->getParameterAsArray($request->get('parent'));
}

$this->include_unstructured_posts = $request->has('include_unstructured_posts')
? filter_var($request->query('include_unstructured_posts'), FILTER_VALIDATE_BOOLEAN)
: true; // defaulte include unstructured posts
$this->form_condition = "all";
$this->form = []; // no conditions
if (!$request->has('form')) {
if ($request->has('include_unstructured_posts') && !$request->get('include_unstructured_posts')) {
if (!$this->include_unstructured_posts) {
$this->form_condition = "not_null";
$this->form = []; // no conditions
Mh-Asmi marked this conversation as resolved.
Show resolved Hide resolved
}
Expand All @@ -121,7 +124,7 @@ public function __construct(Request $request)
$this->form = $this->getParameterAsArray($request->get('form'));
}
}


if ($request->get('status') == 'all') {
$this->status = []; // no conditions
Expand Down Expand Up @@ -155,7 +158,6 @@ public function __construct(Request $request)

$this->set = $this->getParameterAsArray($request->get('set'));
$this->tags = $this->getParameterAsArray($request->get('tags'));
$this->include_unstructured_posts = $request->query('include_unstructured_posts');
}


Expand Down
Loading