Skip to content
Snippets Groups Projects
Unverified Commit 18e7a266 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo :two:
Browse files

Redirect new topic form to the topics list

After successfully creating a new topic, redirect
to the topics list instead of the edit topic form.

Changelog: changed
parent 1573baf5
No related branches found
No related tags found
1 merge request!121482Redirect to topic list on successful topic form submission
......@@ -23,7 +23,7 @@ def create
@topic = Projects::Topic.new(topic_params)
if @topic.save
redirect_to edit_admin_topic_path(@topic), notice: format(_('Topic %{topic_name} was successfully created.'), topic_name: @topic.name)
redirect_to admin_topics_path, notice: format(_('Topic %{topic_name} was successfully created.'), topic_name: @topic.name)
else
render "new"
end
......
......@@ -102,6 +102,12 @@
expect(errors).to contain_exactly(errors.full_message(:title, I18n.t('errors.messages.blank')))
end
it 'redirects to the topics list' do
post :create, params: { projects_topic: { name: 'test-redirect', title: "Test redirect" } }
expect(response).to redirect_to(admin_topics_path)
end
context 'as a normal user' do
before do
sign_in(user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment