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.
This commit is contained in:
Javi Martín
2024-04-11 16:56:24 +02:00
parent c29ad265c6
commit 7beb28bf89

View File

@@ -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? %>
<span class="icon-deleted user-deleted"></span>
<% elsif comment.user.organization? %>
<%= image_tag("avatar_collective.png", size: 32, class: "avatar float-left", alt: "") %>
<% else %>
<% if comment.user.hidden? || comment.user.erased? %>
<span class="icon-deleted user-deleted"></span>
<% 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 %>