-
-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/2728 endorsement to proposals apply new design #2733
Feature/2728 endorsement to proposals apply new design #2733
Conversation
…already endorsed.
Codecov Report
@@ Coverage Diff @@
## master #2733 +/- ##
==========================================
- Coverage 98.85% 98.83% -0.03%
==========================================
Files 1581 1581
Lines 37412 37407 -5
==========================================
- Hits 36985 36972 -13
- Misses 427 435 +8 |
Done, design app updated. :) |
Thanks @Crashillo, but it seems you broke the build of ci/circleci: admin 😢 |
O_o, holy s***. How come? If you check the commit out, you'll see I edited just one view! It seems that a test is broken, somehow related to admin/users? Sorry, but I've no idea how to solve it. Let's see if @decidim/lot-core could help us here. |
It looks like you found a random failing test, #2738 fixes it. I'll reschedule yours to make things work 😄 |
@Crashillo @tramuntanal tests are green! |
@mrcasals Thanks!! 👍 @Crashillo I've just added the login required part. Waiting for the identities popup implemented. Thanks a lot! |
@mrcasals I've executed the specs locally and all passed, is it possible that this "ci/circleci: comments" failure is another random failure? |
I've re-enqueued the job @tramuntanal |
@decidim/lot-core @decidim/product I think it is ready to be merged. |
Hi @tramuntanal I've been checking on staging and it works well. I have just a few comments:
|
Also (I commented this via Telegram)
|
@tramuntanal if any of these improvements (except for @arnaumonty 's first suggestion which I think is critical) involves long complication, I see better to merge and then iterate. |
@tramuntanal @Crashillo ... BTW: it looks fantastic!!! Congrats! |
…n or registration when clicking if participant is not.
…ing the identities and click "Done" the window should close but remained open.
@decidim/lot-core After applying fixes required by @decidim/product this PR is ready to be merged 🥁 |
@@ -68,6 +75,36 @@ def endorsement_button(proposal, from_proposals_list, btn_label = nil, user_grou | |||
current_endorsement_url: current_endorsement_url, | |||
endorse_label: endorse_label, unendorse_label: unendorse_label } | |||
end | |||
|
|||
def fully_endorsed?(proposal, current_user) | |||
if current_user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rewrite this like:
return false unless current_user
user_group_endorsements = current_user.user_groups.verified.all? { |user_group| proposal.endorsed_by?(current_user, user_group) }
user_group_endorsements & proposal.endorsed_by?(current_user)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done!
@@ -68,6 +75,36 @@ def endorsement_button(proposal, from_proposals_list, btn_label = nil, user_grou | |||
current_endorsement_url: current_endorsement_url, | |||
endorse_label: endorse_label, unendorse_label: unendorse_label } | |||
end | |||
|
|||
def fully_endorsed?(proposal, current_user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some docs please
@@ -6,6 +6,7 @@ module Proposals | |||
class ProposalEndorsementsController < Decidim::Proposals::ApplicationController | |||
helper_method :proposal | |||
|
|||
protect_from_forgery except: [:destroy, :create] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary? It seems that with this another site could trigger a creation or deletion of an endorsement (maybe I'm wrong)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been added when applying new designs because the CTA is no longer a button with a form, but a whole div that on click executes a jquery method using vanilla $.ajax. This ajax call does not have any authentication_token to be used when invoking :destroy or :create.
I'll try to rework this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've managed to supply the auth token through the url so now protection from forgery has been re-enabled.
<%= render partial: "endorsements_count", locals: { proposal: @proposal, fully_endorsed: fully_endorsed } %> | ||
<% if current_settings.endorsements_blocked? %> | ||
<%= content_tag :span, t('.endorse'), class: "card__button button #{endorsement_button_classes(false)} disabled", disabled: true, title: t('.endorse') %> | ||
<% elsif not current_user %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elsif not current_user
it's kinds complicated, maybe we can use elsif current_user
and swap the block with the next one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, done.
…se of too much hurry for finishing the task :(.
All requested changes applied.
All tests passing, automatic merging ready, @decidim/lot-core @decidim/product ready to be merged. |
@decidim/lot-core Should I click the "Squash and merge" button? normally it's you that do it. I fear that if we don't do it soon new conflicts will arise 😨 |
@tramuntanal done! |
🎩 What? Why?
📌 Related Issues
📋 Subtasks
CHANGELOG
entry