View Issue Details

IDProjectCategoryView StatusLast Update
0021618mantisbtcode cleanuppublic2017-02-04 11:53
Reporterdregad Assigned Tocproensa  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Target Version1.3.6Fixed in Version2.1.0 
Summary0021618: 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:

  • view_filters_page.php
  • return_dynamic_filters.php
  • view_all_set.php

It should be moved into a new API function.

TagsNo tags attached.

Relationships

related to 0022316 closeddregad Duplicate code to display the filter view type toggle menu item 
child of 0021935 closedcproensa Filter api refactoring, manage stored filters 

Activities

cproensa

cproensa

2016-08-16 20:08

developer   ~0053824

Last edited: 2016-08-16 20:10

Actually, is the whole logic for building a filter that is duplicated across those pages.
See PR 783 that includes a refactor of all that logic into one single point.
precisely: https://github.com/mantisbt/mantisbt/pull/783/commits/d8b7be6cef00021d4250ef6cc8d1b2befb2e70ec

dregad

dregad

2016-10-20 05:58

developer   ~0054298

@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.

cproensa

cproensa

2016-10-20 07:10

developer   ~0054299

I added a few clean ups to make sure that defaults are defined in one single place.
Tracking in the commits to fix this issue #

dregad

dregad

2016-10-20 11:08

developer   ~0054306

OK, I'm reassigning it to you then :-)

dregad

dregad

2017-02-04 11:43

developer   ~0055486

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

dregad

dregad

2017-02-04 11:49

developer   ~0055487

Actually come to think of it, the printing of the toggle button is in fact a separate issue. Sorry about the noise.