/admin/application_settings shows validation errors on wrong page

Summary

If user enters some invalid value to /admin/application_settings/reporting form, and clicks 'Save changes', main settings page will be shown instead of /reporting. Errors also will be hidden.

Steps to reproduce

Screen_Recording_2019-04-15_at_19.02.15 (How one can reproduce the issue - this is very important)

What is the current bug behavior?

See video above

What is the expected correct behavior?

Users sees errors on the same page they entered incorrect value.

Output of checks

Happens locally on current master.

Possible fixes

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/controllers/admin/application_settings_controller.rb#L54

    redirect_path = referer_path(request) || admin_application_settings_path

    respond_to do |format|
      if successful
        format.json { head :ok }
        format.html { redirect_to redirect_path, notice: _('Application settings saved successfully') }
      else
        format.json { head :bad_request }
        format.html { render :show }
      end
    end

In successful scenario we redirect user to the right page. We can try to infer what action to render from referer the same way we do when settings are saved successfully.

Edited Apr 16, 2019 by Vladimir Shushlin
Assignee Loading
Time tracking Loading