Commit 6bc910e1 authored by David Kim's avatar David Kim

Merge branch 'fix-flash-message-for-anonymous-search' into 'master'

Fix flash message for anonymous search

See merge request gitlab-org/gitlab!70453
parents cb00d6c4 506235eb
......@@ -16,7 +16,7 @@ module IssuableCollections
def show_alert_if_search_is_disabled
return if current_user || params[:search].blank? || !html_request? || Feature.disabled?(:disable_anonymous_search, type: :ops)
flash[:notice] = _('You must sign in to search for specific terms.')
flash.now[:notice] = _('You must sign in to search for specific terms.')
end
# rubocop:disable Gitlab/ModuleWithInstanceVariables
......
......@@ -125,7 +125,7 @@ class Explore::ProjectsController < Explore::ApplicationController
def show_alert_if_search_is_disabled
return if current_user || params[:name].blank? && params[:search].blank? || !html_request? || Feature.disabled?(:disable_anonymous_project_search, type: :ops)
flash[:notice] = _('You must sign in to search for specific projects.')
flash.now[:notice] = _('You must sign in to search for specific projects.')
end
end
......
......@@ -214,7 +214,7 @@ RSpec.describe Explore::ProjectsController do
sign_in(create(:user))
get controller_action, params: params_with_name
expect(flash[:notice]).to be_nil
expect(flash.now[:notice]).to be_nil
end
end
end
......@@ -260,14 +260,14 @@ RSpec.describe Explore::ProjectsController do
it 'shows a flash message' do
get controller_action, params: params_with_name
expect(flash[:notice]).to eq('You must sign in to search for specific projects.')
expect(flash.now[:notice]).to eq('You must sign in to search for specific projects.')
end
context 'when search param is not given' do
it 'does not show a flash message' do
get controller_action
expect(flash[:notice]).to be_nil
expect(flash.now[:notice]).to be_nil
end
end
......@@ -275,7 +275,7 @@ RSpec.describe Explore::ProjectsController do
it 'does not show a flash message' do
get controller_action, params: params_with_name.merge(format: :atom)
expect(flash[:notice]).to be_nil
expect(flash.now[:notice]).to be_nil
end
end
end
......@@ -288,7 +288,7 @@ RSpec.describe Explore::ProjectsController do
it 'does not show a flash message' do
get controller_action, params: params_with_name
expect(flash[:notice]).to be_nil
expect(flash.now[:notice]).to be_nil
end
end
end
......
......@@ -12,14 +12,14 @@ RSpec.shared_examples 'issuable list with anonymous search disabled' do |action|
it 'shows a flash message' do
get controller_action, params: params_with_search
expect(flash[:notice]).to eq('You must sign in to search for specific terms.')
expect(flash.now[:notice]).to eq('You must sign in to search for specific terms.')
end
context 'when search param is not given' do
it 'does not show a flash message' do
get controller_action, params: params
expect(flash[:notice]).to be_nil
expect(flash.now[:notice]).to be_nil
end
end
......@@ -28,7 +28,7 @@ RSpec.shared_examples 'issuable list with anonymous search disabled' do |action|
sign_in(create(:user))
get controller_action, params: params_with_search
expect(flash[:notice]).to be_nil
expect(flash.now[:notice]).to be_nil
end
end
......@@ -36,7 +36,7 @@ RSpec.shared_examples 'issuable list with anonymous search disabled' do |action|
it 'does not show a flash message' do
get controller_action, params: params_with_search.merge(format: :atom)
expect(flash[:notice]).to be_nil
expect(flash.now[:notice]).to be_nil
end
end
end
......@@ -49,7 +49,7 @@ RSpec.shared_examples 'issuable list with anonymous search disabled' do |action|
it 'does not show a flash message' do
get controller_action, params: params_with_search
expect(flash[:notice]).to be_nil
expect(flash.now[:notice]).to be_nil
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment