diff --git a/app/controllers/bubbles_controller.rb b/app/controllers/bubbles_controller.rb index 379ba1e1d..7ef4d276d 100644 --- a/app/controllers/bubbles_controller.rb +++ b/app/controllers/bubbles_controller.rb @@ -19,6 +19,7 @@ class BubblesController < ApplicationController end def show + fresh_when etag: @bubble end def edit diff --git a/app/models/comment.rb b/app/models/comment.rb index ae1d8ef6f..b4a342e6b 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,7 +1,7 @@ class Comment < ApplicationRecord include Searchable - belongs_to :bubble + belongs_to :bubble, touch: true belongs_to :creator, class_name: "User", default: -> { Current.user } searchable_by :body, using: :comments_search_index diff --git a/app/models/event.rb b/app/models/event.rb index 76e60ff30..119d871ac 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -4,7 +4,7 @@ class Event < ApplicationRecord include Assignments belongs_to :creator, class_name: "User" - belongs_to :bubble + belongs_to :bubble, touch: true has_one :account, through: :creator diff --git a/app/views/accounts/users/_user.html.erb b/app/views/accounts/users/_user.html.erb index 2a9823444..cb7855dd1 100644 --- a/app/views/accounts/users/_user.html.erb +++ b/app/views/accounts/users/_user.html.erb @@ -7,6 +7,7 @@ + <%# FIXME: Move this Current.user check to a stimulus controller that just checks for admin? or the like we so we can cache user list %> <%= button_to account_user_path(user), method: :delete, class: "btn btn--small btn--negative flex-item-no-shrink", disabled: !Current.user.can_remove?(user), data: { turbo_confirm: "Are you sure you want to permanently remove this person from the account?" } do %> diff --git a/app/views/bubbles/_bubble.html.erb b/app/views/bubbles/_bubble.html.erb index c757ae6a9..49061b584 100644 --- a/app/views/bubbles/_bubble.html.erb +++ b/app/views/bubbles/_bubble.html.erb @@ -1,26 +1,28 @@ -
+<% cache bubble do %> +
-

- <%= turbo_frame_tag bubble, :edit do %> - <%= link_to bubble.title, edit_bucket_bubble_path(bubble.bucket, bubble), class: "txt-undecorated" %> +

+ <%= turbo_frame_tag bubble, :edit do %> + <%= link_to bubble.title, edit_bucket_bubble_path(bubble.bucket, bubble), class: "txt-undecorated" %> + <% end %> +

+ + + + + + + <%= link_to bucket_bubble_path(bubble.bucket, bubble), class: "bubble__link" do %> + <%= bubble.title %> <% end %> - - - - - - - <%= link_to bucket_bubble_path(bubble.bucket, bubble), class: "bubble__link" do %> - <%= bubble.title %> - <% end %> - - <%= render "bubbles/assignments", bubble: bubble %> - <%= render "bubbles/boosts", bubble: bubble %> - <%= render "bubbles/color", bubble: bubble %> - <%= render "bubbles/date", bubble: bubble %> - <%= render "bubbles/image", bubble: bubble %> - <%= render "bubbles/tags", bubble: bubble %> -
+ <%= render "bubbles/assignments", bubble: bubble %> + <%= render "bubbles/boosts", bubble: bubble %> + <%= render "bubbles/color", bubble: bubble %> + <%= render "bubbles/date", bubble: bubble %> + <%= render "bubbles/image", bubble: bubble %> + <%= render "bubbles/tags", bubble: bubble %> +
+<% end %> diff --git a/app/views/bubbles/index.html.erb b/app/views/bubbles/index.html.erb index f2e05afc8..c6ae7517e 100644 --- a/app/views/bubbles/index.html.erb +++ b/app/views/bubbles/index.html.erb @@ -20,7 +20,7 @@
<% if @bubbles.any? %> - <%= render partial: "bubbles/bubble", collection: @bubbles.limit(10) %> + <%= render partial: "bubbles/bubble", collection: @bubbles.limit(10), cached: true %> <% else %>

Nothing here.

<% end %> diff --git a/app/views/bubbles/list/_bubble.html.erb b/app/views/bubbles/list/_bubble.html.erb index 39752aba0..b384160c8 100644 --- a/app/views/bubbles/list/_bubble.html.erb +++ b/app/views/bubbles/list/_bubble.html.erb @@ -24,6 +24,7 @@ <% bubble.tags.each do |tag| %> + <%# FIXME: This is not going to work, this partial must be cacheable, so it can't mutate a changeable view filter live. Need a JS solution. %> <%= link_to "##{tag.title}", bucket_bubbles_path(bubble.bucket, view_filter_params.merge(tag_ids: tag.id)), style: "color: #{bubble.color}" %> <% end %> diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 0cd298ab3..7b310226d 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,3 +1,4 @@ +<%# FIXME: Can't use a Current.user reference in a partial that must be cached. Needs to convert to use Stimulus controller pulling from a meta current-id %> <%= tag.div id: dom_id(comment), class: [ "comment flex align-start full-width", { "comment--mine": Current.user == comment.creator } ] do %>
<%= avatar_tag comment.creator, loading: :lazy %>