Commit 45467ec0 authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak

Fix error messages during dashboard manage action

Change error messages to more action oriented and avoid encoded
characters. For dashboard clone and update actions.
parent 54b12e93
...@@ -24,7 +24,7 @@ module Metrics ...@@ -24,7 +24,7 @@ module Metrics
def execute def execute
catch(:error) do catch(:error) do
throw(:error, error(_(%q(You can't commit to this project)), :forbidden)) unless push_authorized? throw(:error, error(_(%q(You are not allowed to push into this branch. Create another branch or open a merge request.)), :forbidden)) unless push_authorized?
result = ::Files::CreateService.new(project, current_user, dashboard_attrs).execute result = ::Files::CreateService.new(project, current_user, dashboard_attrs).execute
throw(:error, wrap_error(result)) unless result[:status] == :success throw(:error, wrap_error(result)) unless result[:status] == :success
......
...@@ -9,7 +9,7 @@ module Metrics ...@@ -9,7 +9,7 @@ module Metrics
def execute def execute
catch(:error) do catch(:error) do
throw(:error, error(_(%q(You can't commit to this project)), :forbidden)) unless push_authorized? throw(:error, error(_(%q(You are not allowed to push into this branch. Create another branch or open a merge request.)), :forbidden)) unless push_authorized?
result = ::Files::UpdateService.new(project, current_user, dashboard_attrs).execute result = ::Files::UpdateService.new(project, current_user, dashboard_attrs).execute
throw(:error, result.merge(http_status: :bad_request)) unless result[:status] == :success throw(:error, result.merge(http_status: :bad_request)) unless result[:status] == :success
......
---
title: Fix error messages for dashboard clonning process.
merge_request: 26290
author:
type: fixed
...@@ -22440,6 +22440,9 @@ msgstr "" ...@@ -22440,6 +22440,9 @@ msgstr ""
msgid "You are going to transfer %{project_full_name} to another owner. Are you ABSOLUTELY sure?" msgid "You are going to transfer %{project_full_name} to another owner. Are you ABSOLUTELY sure?"
msgstr "" msgstr ""
msgid "You are not allowed to push into this branch. Create another branch or open a merge request."
msgstr ""
msgid "You are not allowed to unlink your primary login account" msgid "You are not allowed to unlink your primary login account"
msgstr "" msgstr ""
...@@ -22560,9 +22563,6 @@ msgstr "" ...@@ -22560,9 +22563,6 @@ msgstr ""
msgid "You can try again using %{begin_link}basic search%{end_link}" msgid "You can try again using %{begin_link}basic search%{end_link}"
msgstr "" msgstr ""
msgid "You can't commit to this project"
msgstr ""
msgid "You cannot access the raw file. Please wait a minute." msgid "You cannot access the raw file. Please wait a minute."
msgstr "" msgstr ""
......
...@@ -29,7 +29,7 @@ describe Metrics::Dashboard::CloneDashboardService, :use_clean_rails_memory_stor ...@@ -29,7 +29,7 @@ describe Metrics::Dashboard::CloneDashboardService, :use_clean_rails_memory_stor
end end
context 'user does not have push right to repository' do context 'user does not have push right to repository' do
it_behaves_like 'misconfigured dashboard service response', :forbidden, %q(You can't commit to this project) it_behaves_like 'misconfigured dashboard service response', :forbidden, %q(You are not allowed to push into this branch. Create another branch or open a merge request.)
end end
context 'with rights to push to the repository' do context 'with rights to push to the repository' do
......
...@@ -27,7 +27,7 @@ describe Metrics::Dashboard::UpdateDashboardService, :use_clean_rails_memory_sto ...@@ -27,7 +27,7 @@ describe Metrics::Dashboard::UpdateDashboardService, :use_clean_rails_memory_sto
end end
context 'user does not have push right to repository' do context 'user does not have push right to repository' do
it_behaves_like 'misconfigured dashboard service response', :forbidden, "You can't commit to this project" it_behaves_like 'misconfigured dashboard service response', :forbidden, "You are not allowed to push into this branch. Create another branch or open a merge request."
end end
context 'with rights to push to the repository' do context 'with rights to push to the repository' do
......
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