Commit 3e1dcbc4 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rs-unlock-file-service-parity' into 'master'

Bring CE-EE parity to app/services/lfs/unlock_file_service.rb

See merge request gitlab-org/gitlab-ce!19017
parents 089c476e bd2b57d2
...@@ -2,14 +2,14 @@ module Lfs ...@@ -2,14 +2,14 @@ module Lfs
class UnlockFileService < BaseService class UnlockFileService < BaseService
def execute def execute
unless can?(current_user, :push_code, project) unless can?(current_user, :push_code, project)
raise Gitlab::GitAccess::UnauthorizedError, 'You have no permissions' raise Gitlab::GitAccess::UnauthorizedError, _('You have no permissions')
end end
unlock_file unlock_file
rescue Gitlab::GitAccess::UnauthorizedError => ex rescue Gitlab::GitAccess::UnauthorizedError => ex
error(ex.message, 403) error(ex.message, 403)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
error('Lock not found', 404) error(_('Lock not found'), 404)
rescue => ex rescue => ex
error(ex.message, 500) error(ex.message, 500)
end end
...@@ -24,9 +24,9 @@ module Lfs ...@@ -24,9 +24,9 @@ module Lfs
success(lock: lock, http_status: :ok) success(lock: lock, http_status: :ok)
elsif forced elsif forced
error('You must have master access to force delete a lock', 403) error(_('You must have master access to force delete a lock'), 403)
else else
error("#{lock.path} is locked by GitLab User #{lock.user_id}", 403) error(_("%{lock_path} is locked by GitLab User %{lock_user_id}") % { lock_path: lock.path, lock_user_id: lock.user_id }, 403)
end 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