Commit 09b102fa authored by Etienne Baqué's avatar Etienne Baqué Committed by Nick Thomas

Removed release edit url for user not allowed to update

parent 0cc472cd
......@@ -58,6 +58,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
end
def release_edit_page_available?
::Feature.enabled?(:release_edit_page, project, default_enabled: true)
::Feature.enabled?(:release_edit_page, project, default_enabled: true) &&
can?(current_user, :update_release, release)
end
end
---
title: Remove Release edit url for users not allowed to update a release
merge_request: 20136
author:
type: fixed
......@@ -38,7 +38,7 @@
"additionalProperties": false
},
"_links": {
"required": ["merge_requests_url", "issues_url", "edit_url"],
"required": ["merge_requests_url", "issues_url"],
"properties": {
"merge_requests_url": { "type": "string" },
"issues_url": { "type": "string" },
......
......@@ -26,11 +26,10 @@
"additionalProperties": false
},
"_links": {
"required": ["merge_requests_url", "issues_url", "edit_url"],
"required": ["merge_requests_url", "issues_url"],
"properties": {
"merge_requests_url": { "type": "string" },
"issues_url": { "type": "string" },
"edit_url": { "type": "string"}
"issues_url": { "type": "string" }
}
}
},
......
......@@ -97,5 +97,11 @@ describe ReleasePresenter do
it { is_expected.to be_nil }
end
context 'when a user is not allowed to update a release' do
let(:presenter) { described_class.new(release, current_user: guest) }
it { is_expected.to be_nil }
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