View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0021618 | mantisbt | code cleanup | public | 2016-08-16 18:36 | 2017-02-04 11:53 | 
| Reporter | dregad | Assigned To | cproensa | ||
| Priority | normal | Severity | minor | Reproducibility | N/A | 
| Status | closed | Resolution | fixed | ||
| Target Version | 1.3.6 | Fixed in Version | 2.1.0 | ||
| Summary | 0021618: Duplicate code to determine the default view type | ||||
| Description | The logic to determine the default view type based on $g_view_filters config option, and use it to set the current filter's view_type from the GPC parameter is duplicated in 3 different places: 
 It should be moved into a new API function. | ||||
| Tags | No tags attached. | ||||
| Actually, is the whole logic for building a filter that is duplicated across those pages. | |
| @cproensa considering the work in progress to refactor filter api in PR https://github.com/mantisbt/mantisbt/pull/862, I'm not sure if this issue should remain open (and be referenced as being fixed by one of the commits in your branch), or closed as duplicate of some other issue. | |
| I added a few clean ups to make sure that defaults are defined in one single place. | |
| OK, I'm reassigning it to you then :-) | |
| I'm reopening this issue, as it turns out that the refactoring of the filter API did not remove the code duplication I was referring to. There are still 3 occurences of duplicated code to display the simple/advanced filter view types, in filter_api.php, manage_filter_edit_page.php and view_filters_page.php. This is addressed in PR https://github.com/mantisbt/mantisbt/pull/1018 | |
| Actually come to think of it, the printing of the toggle button is in fact a separate issue. Sorry about the noise. | |
