From 7beb28bf89a48d1304c0f24a9b0aa487aa90effa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 11 Apr 2024 16:56:24 +0200 Subject: [PATCH] Simplify the conditions to render comment avatars It was hard to understand that the nested `if` could actually be `elsif`, and the indentation was a bit broken. --- app/components/comments/avatar_component.html.erb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/components/comments/avatar_component.html.erb b/app/components/comments/avatar_component.html.erb index 9dd1c08f8..0c95fa943 100644 --- a/app/components/comments/avatar_component.html.erb +++ b/app/components/comments/avatar_component.html.erb @@ -2,12 +2,10 @@ <%= image_tag("avatar_admin.png", size: 32, class: "admin-avatar float-left", alt: "") %> <% elsif comment.as_moderator? %> <%= image_tag("avatar_moderator.png", size: 32, class: "moderator-avatar float-left", alt: "") %> +<% elsif comment.user.hidden? || comment.user.erased? %> + +<% elsif comment.user.organization? %> + <%= image_tag("avatar_collective.png", size: 32, class: "avatar float-left", alt: "") %> <% else %> -<% if comment.user.hidden? || comment.user.erased? %> - - <% elsif comment.user.organization? %> - <%= image_tag("avatar_collective.png", size: 32, class: "avatar float-left", alt: "") %> - <% else %> - <%= render Shared::AvatarComponent.new(comment.user, size: 32, class: "float-left") %> - <% end %> + <%= render Shared::AvatarComponent.new(comment.user, size: 32, class: "float-left") %> <% end %>