Remove redundant ordering for most-active bubbles

The base bubbles query is the same, differing only in the ordering and limit.
This commit is contained in:
Jeffrey Hardy
2024-10-03 14:10:11 -04:00
parent 462032155c
commit ad1c7ae51d
2 changed files with 4 additions and 6 deletions
+1 -4
View File
@@ -4,18 +4,15 @@ class BubblesController < ApplicationController
before_action :set_bubble, only: %i[ show edit update ]
def index
@bubbles = @bucket.bubbles.not_popped.reverse_chronologically
@bubbles = @bucket.bubbles.not_popped
if params[:filter].present?
@bubbles = @bubbles.mentioning(params[:filter])
end
@most_active_bubbles = @bubbles.ordered_by_activity.limit(10)
if params[:tag_id]
@tag = Current.account.tags.find(params[:tag_id])
@bubbles = @bubbles.tagged_with(@tag)
@most_active_bubbles = @most_active_bubbles.tagged_with(@tag)
end
end
+3 -2
View File
@@ -100,7 +100,7 @@
<% end %>
<section class="windshield flex-inline flex-wrap gap justify-center align-end" style="view-transition-name: windshield_<%= @bucket.id %>">
<%= render @most_active_bubbles %>
<%= render partial: "bubbles/bubble", collection: @bubbles.ordered_by_activity.limit(10) %>
</section>
<section class="bubbles-list unpad-inline center margin-block-start">
@@ -109,7 +109,8 @@
<input type="search" name="filter" class="input center flex-inline" placeholder="Type to filter…" value="<%= params[:filter] %>">
</form>
</header>
<ul class="unpad margin-none flex flex-column txt-align-start center">
<%= render partial: "bubbles/list/bubble", collection: @bubbles %>
<%= render partial: "bubbles/list/bubble", collection: @bubbles.reverse_chronologically %>
</ul>
</section>