Skip to content

Remove empty query params from many filters [failure unrelated]

Created by: cirosantilli

Before this PR, clicking on filters like sort at the issues index would give a URL with many empty parameters like:

assignee_id=&label_name=&milestone_id=&scope=all&sort=newest&state=opened

Now, assignee_id=&label_name=&milestone_id= only show if explicitly set, so the URL would be:

scope=all&sort=oldest&state=opened

The change should affect issues and merge request in indexes, group and global searches.

This works because we were using the built-in helper url_for, which removes keys which have nil values from params, while before params was being built with to_params which does not.

scope and state should also be removed if not set, but implementation there is more delicate because those params are always being set from controller and used in the logic as in https://github.com/gitlabhq/gitlabhq/blob/0f12e051c072521460fadfce2cec4e9768bc35ba/app/controllers/projects/issues_controller.rb#L131

Merge request reports