Commit 6e83a31f authored by Paul Slaughter's avatar Paul Slaughter Committed by Denys Mishunov

Resolved EE differences in app/views/profiles/keys

**How?**
It creates a base method `can_delete?` on Key
which will always be true in CE and is overridden in EE.

Added changelog entry
parent be01c431
...@@ -59,6 +59,11 @@ class Key < ApplicationRecord ...@@ -59,6 +59,11 @@ class Key < ApplicationRecord
"key-#{id}" "key-#{id}"
end end
# EE overrides this
def can_delete?
true
end
# rubocop: disable CodeReuse/ServiceClass # rubocop: disable CodeReuse/ServiceClass
def update_last_used_at def update_last_used_at
Keys::LastUsedService.new(self).execute Keys::LastUsedService.new(self).execute
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
.float-right .float-right
%span.key-created-at %span.key-created-at
= s_('Profiles|Created %{time_ago}'.html_safe) % { time_ago:time_ago_with_tooltip(key.created_at)} = s_('Profiles|Created %{time_ago}'.html_safe) % { time_ago:time_ago_with_tooltip(key.created_at)}
= link_to path_to_key(key, is_admin), data: { confirm: _('Are you sure?')}, method: :delete, class: "btn btn-transparent prepend-left-10" do - if key.can_delete?
%span.sr-only= _('Remove') = link_to path_to_key(key, is_admin), data: { confirm: _('Are you sure?')}, method: :delete, class: "btn btn-transparent prepend-left-10" do
= icon('trash') %span.sr-only= _('Remove')
= icon('trash')
...@@ -24,4 +24,5 @@ ...@@ -24,4 +24,5 @@
= @key.key = @key.key
.col-md-12 .col-md-12
.float-right .float-right
= link_to _('Remove'), path_to_key(@key, is_admin), data: {confirm: _('Are you sure?')}, method: :delete, class: "btn btn-remove delete-key qa-delete-key-button" - if @key.can_delete?
= link_to _('Remove'), path_to_key(@key, is_admin), data: {confirm: _('Are you sure?')}, method: :delete, class: "btn btn-remove delete-key qa-delete-key-button"
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