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 not all issues returned via REST API. #1464
Conversation
- Add FILTER_STANDARD_ANY - Add filter_create_any to filter_api - Handle FILTER_STANDARD_ANY in filter_standard_get - Use in issues_rest, if the request doesn't contain a filter_id Fixes #25102
If we consider
I have been slowly changing the filter api, and one of the future plans i had in mind is separate the actual concepts of "empty" and "default" filter. Having your addition in filter_standard_get() as a single point to get an actual "empty" filter is good for future refactoring. So in summary: My suggestions may not be accurate or can lead to other issues, so pleas don't follow them blindly. Let's just make a starting point for a common approach that fits in. |
I choosed 'any' along the lines of the other standard filters ( 'assigned', 'unassigned', 'reported', 'monitored' ), For now there's only one caller for 'filter_standard_get': mc_filter_get_issues(), that's soap (also used called from rest).
And regarding 'view_type', that's WebUI, any requester (soap, rest, ...) should't bother at all, we should At least this is a change, fixing a real issue without breaking BC. Anything else could be applied on top. |
Good point, i buy it.
filter_standard_get is a wrapper for filter_create_xxxx, which are also user from "my view"
Right now there's no other way to customize a filter, other that directly setting filter[xxx] properties. It's nothing more than an associative array. What i mean with fiddling the low level, is: What else should be overriden? filter_standard_get should be neutral about the project property. I suggest to not modify filter_standard_get, just let the 'any' filter to have project_id=META_FILTER_CURRENT (it's by default), and let the soap api apply the project in context with
'_view_type' (which i hope we can get rid of in a close future) has some side effects on the project scope of the filter. See https://www.mantisbt.org/bugs/view.php?id=20238
I'd rather remove it, in future iterations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @obmsch for your contribution.
Just confirming some functional behaviors:
- Get Issues for SOAP/REST will now return all issues independent of user's filter and including closed issues.
- How does Get Issues from REST API get project id? I assume it assumed all projects, right? Haven't looked if this is applicable to SOAP API or not.
- Does
GET {{url}}/api/rest/issues?filter_id=any
work likeGET {{url}}/api/rest/issues?filter_id=monitored
. - Similar to
any
should we havedefault
? This would return all issues that are not closed? Similar to the filter a brand new user gets by default.
@vboctor notwithstanding @cproensa comments, the PRs intension was to fix an issue with rest.
REST will, SOAP not. In contrast to REST, SOAP doesn't offer a filter on the get-issue API, and an API
That's either through request param 'project_id' (may be 0 = ALL_PROJECTS), or defaults to ALL_PROJECTS.
If request param 'filter_id' exists that's passed through, otherwise the filter_id is set to
From an API consumers POW, I would rather have an explizit |
@vboctor In this PR:
I expect the api to have a consistent behaviour, unaffected by that config option.
I'd say yes, that is a good addition.
At this moment, the "default" filter is equivalent to "unclosed", but that may change in the future. For example, if we add option to set a "default" filter for each user. |
In the Web UI and REST API, we should be consistent on including sub-project issues. Simple/Advanced filters is just a way to define the filter, but shouldn't change its behavior.
Seems like we agree on this. And I also was thinking of the point that you mentioned, the default filter may change over time due to MantisBT changing the default filter or providing a feature in the future where the admin can define the default filter for projects. That is different from the user's
As for
There is no desire to really innovate in SOAP API, just a bug fix applies, then that's a bonus. If a feature is added, e.g. SOAP API supports a new type of known filter "any", then we should create an issue in the tracker for it, so users know it is there. However, no desire to add new methods or functionality in SOAP. I expect we will retire the SOAP API eventually. |
function filter_create_any( $p_project_id ) { | ||
$t_filter = filter_get_default(); | ||
|
||
$t_filter[FILTER_PROPERTY_HANDLER_ID] = array( '0' => META_FILTER_ANY ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to set there 3 criteria that just say any/none? I would expect that omitting these should deliver the same results. @cproensa ? Also should the approach be to create an array with desired criteria then call filter_ensure_valid_filter()
on it? Why trigger two calls of filter_ensure_valid_filter()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has already been noted, that of those three, only FILTER_PROPERTY_HIDE_STATUS => META_FILTER_NONE
is needed
Also should the approach be to create an array with desired criteria then call
filter_ensure_valid_filter()
on it?
Maybe filter_get_default() is not needed, and can be done with a raw array and call validate on it.
But note that this pattern is already there in other previous filter_create_xxx functions
Agree, but that's just how it works since long time:
The best course of action is to get rid of the simple/advanced mode, in some future. The test i did by changing Note that other named filters: assigned, monitored, etc, do fill the project_id, so this problem was already affecting them too before this PR. The way to fix this can be (for always including subprojects)
or for never including subprojects:
|
To be honest, I got somewhat got lost here. The original aim of the PR was to simply fix a problem with the REST GetIssues API not returning all issues for project(n/0=ALL_PROJECTS). At least the closed ones are missing. I tried to achieve that, without changing any other behaviour.
I have no problem with at all. Those are only there, because I wanted to assure that I don't miss anything. This filter stuff keeps my head wheeling. @cproensa really good work.
|
Merged via 4cc687a - we should open separate bugs for sub-project issues. |
@cproensa I have opened a bug fix difference between simple and advanced filters for handling sub-project issues: |
Currently an implicit current/default filter is applied. And therefore, the
returned issue list might lack a lot of issues assigned to the project. For
the default filter that's actually only 'closed' issues, for the current that
might be all (any filter with empty results).
Fixes #25102