mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 15:35:22 +02:00
Refactor changelog view to handle missing avatars gracefully and improve session sign-out logic in tests
This commit is contained in:
parent
803d22a2f6
commit
6bf6adc9fd
3 changed files with 18 additions and 8 deletions
|
@ -4,18 +4,24 @@
|
||||||
<div class="flex flex-col md:flex-row justify-between gap-4 mb-12 last:mb-0">
|
<div class="flex flex-col md:flex-row justify-between gap-4 mb-12 last:mb-0">
|
||||||
<div class="w-full md:w-1/3">
|
<div class="w-full md:w-1/3">
|
||||||
<div class="md:px-3 flex items-center gap-3">
|
<div class="md:px-3 flex items-center gap-3">
|
||||||
|
<% if @release_notes[:avatar].present? %>
|
||||||
<div class="text-white shrink-0 w-9 h-9">
|
<div class="text-white shrink-0 w-9 h-9">
|
||||||
<%= image_tag @release_notes[:avatar], class: "rounded-full w-full h-full object-cover" if @release_notes[:avatar].present? %>
|
<%= image_tag @release_notes[:avatar], class: "rounded-full w-full h-full object-cover" %>
|
||||||
</div>
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="bg-gray-300 text-gray-600 shrink-0 w-9 h-9 rounded-full flex items-center justify-center text-sm font-medium">
|
||||||
|
<%= @release_notes[:username]&.first&.upcase || "?" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<div>
|
<div>
|
||||||
<a class="text-primary font-medium text-sm" href="https://github.com/<%= @release_notes[:username] %>"><%= "@#{@release_notes[:username]}" %></a>
|
<a class="text-primary font-medium text-sm" href="https://github.com/<%= @release_notes[:username] %>"><%= "@#{@release_notes[:username]}" %></a>
|
||||||
<div class="text-secondary text-sm"><%= @release_notes[:published_at]&.strftime("%B %d, %Y") %></div>
|
<div class="text-secondary text-sm"><%= @release_notes[:published_at].strftime("%B %d, %Y") %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full md:w-2/3 text-secondary text-sm prose prose--github-release-notes">
|
<div class="w-full md:w-2/3 text-secondary text-sm prose prose--github-release-notes">
|
||||||
<h2 class="mb-5 text-xl text-primary"><%= @release_notes[:name] %></h2>
|
<h2 class="mb-5 text-xl text-primary"><%= @release_notes[:name] %></h2>
|
||||||
<%= @release_notes[:body]&.html_safe %>
|
<%= @release_notes[:body].html_safe %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,9 @@ class MfaControllerTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def sign_out
|
def sign_out
|
||||||
delete session_path(@user.sessions.last) if @user.sessions.any?
|
@user.sessions.each do |session|
|
||||||
|
delete session_path(session)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "redirects to root if MFA already enabled" do
|
test "redirects to root if MFA already enabled" do
|
||||||
|
|
|
@ -162,6 +162,8 @@ end
|
||||||
private
|
private
|
||||||
|
|
||||||
def sign_out
|
def sign_out
|
||||||
delete session_path(@user.sessions.last) if @user.sessions.any?
|
@user.sessions.each do |session|
|
||||||
end
|
delete session_path(session)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue