Skip to content

Commit ef4bf18

Browse files
Disable endorse button if endorsements blocked even when user is not logged in
1 parent 68f456e commit ef4bf18

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

decidim-core/app/cells/decidim/endorsement_buttons_cell.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ class EndorsementButtonsCell < Decidim::ViewModel
2626
# - if users can endorse with many identities (of their user_groups)
2727
# - if users require verification
2828
def show
29+
return render :disabled_endorsements if endorsements_blocked?
2930
return render unless current_user
30-
return render :disabled_endorsements if endorsements_blocked_or_user_can_not_participate?
31+
return render :disabled_endorsements if user_can_not_participate?
3132
return render :verification_modal unless endorse_allowed?
3233
return render :select_identity_button if user_has_verified_groups?
3334

@@ -63,8 +64,12 @@ def button_content
6364

6465
private
6566

66-
def endorsements_blocked_or_user_can_not_participate?
67-
current_settings.endorsements_blocked? || !current_component.participatory_space.can_participate?(current_user)
67+
def endorsements_blocked?
68+
current_settings.endorsements_blocked?
69+
end
70+
71+
def user_can_not_participate?
72+
!current_component.participatory_space.can_participate?(current_user)
6873
end
6974

7075
def endorse_allowed?

0 commit comments

Comments
 (0)