17 lines
1.2 KiB
Text
17 lines
1.2 KiB
Text
- model_name = source.model_name.to_s.downcase
|
|
|
|
- if can?(current_user, :"destroy_#{model_name}_member", source.members.find_by(user_id: current_user.id)) # rubocop: disable CodeReuse/ActiveRecord
|
|
- link_text = source.is_a?(Group) ? _('Leave group') : _('Leave project')
|
|
= link_to link_text, polymorphic_path([:leave, source, :members]),
|
|
method: :delete,
|
|
data: { confirm: leave_confirmation_message(source), qa_selector: 'leave_group_link' },
|
|
class: '.gl-pl-3.gl-border-l-1.gl-border-l-solid.gl-border-l-gray-500 js-leave-link'
|
|
- elsif requester = source.requesters.find_by(user_id: current_user.id) # rubocop: disable CodeReuse/ActiveRecord
|
|
= link_to _('Withdraw Access Request'), polymorphic_path([:leave, source, :members]),
|
|
method: :delete,
|
|
data: { confirm: remove_member_message(requester) },
|
|
class: '.gl-pl-3.gl-border-l-1.gl-border-l-solid.gl-border-l-gray-500'
|
|
- elsif source.request_access_enabled && can?(current_user, :request_access, source)
|
|
= link_to _('Request Access'), polymorphic_path([:request_access, source, :members]),
|
|
method: :post,
|
|
class: '.gl-pl-3.gl-border-l-1.gl-border-l-solid.gl-border-l-gray-500'
|