diff --git a/app/assets/stylesheets/avatars.css b/app/assets/stylesheets/avatars.css index 9c55ef4e9..e3f15d4ab 100644 --- a/app/assets/stylesheets/avatars.css +++ b/app/assets/stylesheets/avatars.css @@ -22,11 +22,6 @@ max-inline-size: 100%; object-fit: cover; } - - span[data-creator-id] { - display: grid; - place-items: center; - } } .avatar__form { diff --git a/app/controllers/my/avatars_controller.rb b/app/controllers/my/avatars_controller.rb deleted file mode 100644 index 70f714ae2..000000000 --- a/app/controllers/my/avatars_controller.rb +++ /dev/null @@ -1,16 +0,0 @@ -class My::AvatarsController < ApplicationController - def show - if stale? Current.user - if Current.user.avatar.attached? - redirect_to rails_blob_url(Current.user.avatar_thumbnail, disposition: "inline") - else - render_initials - end - end - end - - private - def render_initials - render formats: :svg - end -end diff --git a/app/controllers/users/avatars_controller.rb b/app/controllers/users/avatars_controller.rb index 69ed38f0c..420dbe5b6 100644 --- a/app/controllers/users/avatars_controller.rb +++ b/app/controllers/users/avatars_controller.rb @@ -5,20 +5,17 @@ class Users::AvatarsController < ApplicationController before_action :ensure_permission_to_administer_user, only: :destroy def show - expires_in 30.minutes, public: true, stale_while_revalidate: 1.week - if @user.system? redirect_to view_context.image_path("system_user.png") elsif @user.avatar.attached? redirect_to rails_blob_url(@user.avatar_thumbnail, disposition: "inline") - else + elsif stale? @user, cache_control: cache_control render_initials end end def destroy @user.avatar.destroy - @user.touch redirect_to @user end @@ -31,6 +28,14 @@ class Users::AvatarsController < ApplicationController head :forbidden unless Current.user.can_change?(@user) end + def cache_control + if @user == Current.user + {} + else + { max_age: 30.minutes, stale_while_revalidate: 1.week } + end + end + def render_initials render formats: :svg end diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index 503430c9a..7c064a650 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -42,11 +42,6 @@ module AvatarsHelper end def avatar_image_tag(user, **options) - tag.span data: { creator_id: user.id } do - safe_join [ - image_tag(my_avatar_url(script_name: user.account.slug), aria: { hidden: "true" }, size: 48, title: user.name, data: { only_visible_to_you: true }, **options), - image_tag(user_avatar_url(user, script_name: user.account.slug), aria: { hidden: "true" }, size: 48, title: user.name, data: { only_visible_to_others: true }, **options) - ] - end + image_tag user_avatar_url(user, script_name: user.account.slug), aria: { hidden: "true" }, size: 48, title: user.name, **options end end diff --git a/app/views/cards/comments/_comment.html.erb b/app/views/cards/comments/_comment.html.erb index fee6d6d25..6a825e9ec 100644 --- a/app/views/cards/comments/_comment.html.erb +++ b/app/views/cards/comments/_comment.html.erb @@ -1,4 +1,5 @@ <% cache comment do %> + <%# Helper Dependency Updated: avatar_image_tag 2025-12-15 %> <%= turbo_frame_tag comment, :container do %> <%# Cache bump 2025-12-14: action text attachment rendering changed for lightbox -%>