Skip to content

Commit

Permalink
Merge pull request #4856 from h-kataria/dont_load_default_seacrh_on_t…
Browse files Browse the repository at this point in the history
…agging_form

No need to load default search when user is on tagging screen.

(cherry picked from commit 80c1c66)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1643458
  • Loading branch information
mzazrivec authored and simaishi committed Nov 1, 2018
1 parent 056aac1 commit 7170c37
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -1388,7 +1388,7 @@ def get_view(db, options = {}, fetch_data = false)
(action_name == "show_list" && !session[:menu_click])
adv_search_build(db)
end
if @edit && !@edit[:selected] && # Load default search if search @edit hash exists
if @edit && !@edit[:selected] && !@edit[:tagging] && # Load default search if search @edit hash exists
settings(:default_search, db.to_sym) # and item in listnav not selected
load_default_search(settings(:default_search, db.to_sym))
end
Expand Down
18 changes: 18 additions & 0 deletions spec/controllers/application_controller_spec.rb
Expand Up @@ -274,6 +274,24 @@
end
end

describe "#get_view" do
before do
search = FactoryGirl.create(:miq_search, :name => 'sds')
user = FactoryGirl.create(:user_with_group, :settings => {:default_search => {:Host => search.id}})
login_as user
session[:settings] = {:default_search => {:Host => search.id},
:views => {:persistentvolume => 'list'},
:perpage => {:list => 10}}
controller.instance_variable_set(:@settings, :default_search => {:Host => search.id})
end

it "does not load default selected search on tagging screen" do
controller.instance_variable_set(:@edit, :tagging => "Host")
expect(controller).to_not receive(:load_default_search)
controller.send(:get_view, "Host", :gtl_dbname => :host)
end
end

describe "#build_user_emails_for_edit" do
before :each do
EvmSpecHelper.local_miq_server
Expand Down

0 comments on commit 7170c37

Please sign in to comment.