Commit 824f825e authored by briankabiro's avatar briankabiro

Remove unnecessary translation from merge request model

In `merge_request.rb`, the rebase_lock_message should be translated
but it is not because it is saved to a class constant. This change
generates the message dynamically.
parent 11311bd5
......@@ -262,8 +262,6 @@ class MergeRequest < ApplicationRecord
RebaseLockTimeout = Class.new(StandardError)
REBASE_LOCK_MESSAGE = _("Failed to enqueue the rebase operation, possibly due to a long-lived transaction. Try again later.")
def self.reference_prefix
'!'
end
......@@ -1514,7 +1512,7 @@ class MergeRequest < ApplicationRecord
end
rescue ActiveRecord::LockWaitTimeout => e
Gitlab::ErrorTracking.track_exception(e)
raise RebaseLockTimeout, REBASE_LOCK_MESSAGE
raise RebaseLockTimeout, _('Failed to enqueue the rebase operation, possibly due to a long-lived transaction. Try again later.')
end
def source_project_variables
......
---
title: Fix rebase error message translation in merge requests
merge_request: 22952
author: briankabiro
type: fixed
......@@ -1412,7 +1412,7 @@ describe Projects::MergeRequestsController do
post_rebase
expect(response.status).to eq(409)
expect(json_response['merge_error']).to eq(MergeRequest::REBASE_LOCK_MESSAGE)
expect(json_response['merge_error']).to eq('Failed to enqueue the rebase operation, possibly due to a long-lived transaction. Try again later.')
end
end
......
......@@ -2260,7 +2260,7 @@ describe API::MergeRequests do
put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/rebase", user)
expect(response).to have_gitlab_http_status(409)
expect(json_response['message']).to eq(MergeRequest::REBASE_LOCK_MESSAGE)
expect(json_response['message']).to eq('Failed to enqueue the rebase operation, possibly due to a long-lived transaction. Try again later.')
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