-
Notifications
You must be signed in to change notification settings - Fork 45
[Org Home] Disable transactions if organizers aren't signed in #10647
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
base: main
Are you sure you want to change the base?
[Org Home] Disable transactions if organizers aren't signed in #10647
Conversation
…ributes for organizers
<a | ||
class="homepage-transaction <%= organizer_signed_in? && Flipper.enabled?(:hcb_code_popovers_2023_06_16, current_user) && (@event || transaction.local_hcb_code.event).present? ? "cursor-pointer hover:bg-gray-50 active:bg-gray-100 transition-colors dark:hover:bg-neutral-700 dark:active:bg-neutral-600" : "" %>" | ||
<% if organizer_signed_in? %> | ||
href="<%= url_for(transaction.local_hcb_code) %>" | ||
data-behavior="modal_trigger" | ||
data-modal="money_movement_tx_details_<%= transaction.local_hcb_code.__id__ %>" | ||
<% end %>> |
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.
suggestion: If I'm reading this correctly, we're basically removing all useful classes and properties from this <a>
tag when organizer_signed_in?
, which leaves me with two questions:
-
Do we need this to be a
<a>
when there is nohref
?→ The
capture
helper might come in handy here so we can wrap the inner content with different outer elements. -
Can we simplify the
class
attribute logic?→ Would a local variable be more readable?
^ putting the above together we end up with something like
<% @money_in.each do |transaction| %>
<% rendered_transaction = capture do %>
<!-- What was previously in the `<a>` tag -->
<% end %>
<% if organizer.signed_in? %>
<!-- 👇 We should probably name this -->
<% name_this_concept = Flipper.enabled?(:hcb_code_popovers_2023_06_16, current_user) && (@event || transaction.local_hcb_code.event).present? %>
<% css_classes = "cursor-pointer hover:bg-gray-50 active:bg-gray-100 transition-colors dark:hover:bg-neutral-700 dark:active:bg-neutral-600" if name_this_concept %>
<a
class="homepage-transaction <%= css_classes %>"
href="<%= url_for(transaction.local_hcb_code) %>"
data-behavior="modal_trigger"
data-modal="money_movement_tx_details_<%= transaction.local_hcb_code.__id__ %>"
>
<%= rendered_transaction %>
</a>
<% else %>
<div class="homepage-transaction">
<%= rendered_transaction %>
</div>
<% end %>
<% end %>
This pull request refines the logic for rendering transaction links in the
app/views/events/home
directory. The changes ensure that links are only clickable when the user is signed in as an organizer, improving the user experience and preventing unintended behavior for non-organizers.Updates to transaction link rendering:
app/views/events/home/_money_movement.html.erb
: Updated the "money in" and "money out" transaction links to include a conditional check fororganizer_signed_in?
. Links are now only rendered withhref
and associated attributes if the user is an organizer. [1] [2]app/views/events/home/_transactions.html.erb
: Applied the sameorganizer_signed_in?
conditional logic to the "recent transactions" links, ensuring consistent behavior across transaction displays.