2019-02-15 15:39:39 +05:30
|
|
|
- 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,
|
2022-04-04 11:22:00 +05:30
|
|
|
aria: { label: link_text },
|
|
|
|
data: { confirm: leave_confirmation_message(source), confirm_btn_variant: 'danger', qa_selector: 'leave_group_link' },
|
2021-11-11 11:23:49 +05:30
|
|
|
class: 'js-leave-link'
|
2019-02-15 15:39:39 +05:30
|
|
|
- elsif requester = source.requesters.find_by(user_id: current_user.id) # rubocop: disable CodeReuse/ActiveRecord
|
2023-01-13 00:05:48 +05:30
|
|
|
- if can?(current_user, :withdraw_member_access_request, requester)
|
|
|
|
= link_to _('Withdraw Access Request'), polymorphic_path([:leave, source, :members]),
|
|
|
|
method: :delete,
|
|
|
|
data: { confirm: remove_member_message(requester) }
|
2019-02-15 15:39:39 +05:30
|
|
|
- elsif source.request_access_enabled && can?(current_user, :request_access, source)
|
|
|
|
= link_to _('Request Access'), polymorphic_path([:request_access, source, :members]),
|
2021-11-11 11:23:49 +05:30
|
|
|
method: :post
|