Display flash message to unauthenticated user when creating new issue
This commit is contained in:
parent
a634e53ac5
commit
97941d2cf5
2 changed files with 10 additions and 0 deletions
|
@ -260,4 +260,13 @@ class Projects::IssuesController < Projects::ApplicationController
|
||||||
:milestone_id, :due_date, :state_event, :task_num, :lock_version, label_ids: []
|
:milestone_id, :due_date, :state_event, :task_num, :lock_version, label_ids: []
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def authenticate_user!
|
||||||
|
return if current_user
|
||||||
|
|
||||||
|
notice = "Please sign in to create the new issue."
|
||||||
|
|
||||||
|
store_location_for :user, request.fullpath
|
||||||
|
redirect_to new_user_session_path, notice: notice
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -90,6 +90,7 @@ describe Projects::IssuesController do
|
||||||
it 'redirects to signin if not logged in' do
|
it 'redirects to signin if not logged in' do
|
||||||
get :new, namespace_id: project.namespace, project_id: project
|
get :new, namespace_id: project.namespace, project_id: project
|
||||||
|
|
||||||
|
expect(flash[:notice]).to eq 'Please sign in to create the new issue.'
|
||||||
expect(response).to redirect_to(new_user_session_path)
|
expect(response).to redirect_to(new_user_session_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue