mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Fix changelog page crash when GitHub release notes are unavailable (#2314)
* Fix changelog page crash when GitHub release notes are unavailable * Refactor changelog view to handle missing avatars gracefully and improve session sign-out logic in tests * Enhance changelog view to display fallback messages for unavailable release notes and publication dates * Update onboarding system tests to reflect UI changes and improve assertions - Changed button labels from "Get started" to "Continue" and "Complete" to align with updated UI. - Updated text assertions for clarity, changing "Set your preferences" to "Configure your preferences". - Adjusted locale selection options to include language codes. - Enhanced validation error handling in preferences form. - Improved navigation assertions to ensure accurate path checks.
This commit is contained in:
parent
6dae236fe0
commit
3cc88f3e98
6 changed files with 82 additions and 27 deletions
|
@ -29,6 +29,17 @@ class PagesController < ApplicationController
|
|||
def changelog
|
||||
@release_notes = github_provider.fetch_latest_release_notes
|
||||
|
||||
# Fallback if no release notes are available
|
||||
if @release_notes.nil?
|
||||
@release_notes = {
|
||||
avatar: "https://github.com/maybe-finance.png",
|
||||
username: "maybe-finance",
|
||||
name: "Release notes unavailable",
|
||||
published_at: Date.current,
|
||||
body: "<p>Unable to fetch the latest release notes at this time. Please check back later or visit our <a href='https://github.com/maybe-finance/maybe/releases' target='_blank'>GitHub releases page</a> directly.</p>"
|
||||
}
|
||||
end
|
||||
|
||||
render layout: "settings"
|
||||
end
|
||||
|
||||
|
|
|
@ -4,18 +4,24 @@
|
|||
<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="md:px-3 flex items-center gap-3">
|
||||
<div class="text-white shrink-0 w-9 h-9">
|
||||
<%= image_tag @release_notes[:avatar], class: "rounded-full w-full h-full object-cover" %>
|
||||
</div>
|
||||
<% if @release_notes[:avatar].present? %>
|
||||
<div class="text-white shrink-0 w-9 h-9">
|
||||
<%= image_tag @release_notes[:avatar], class: "rounded-full w-full h-full object-cover" %>
|
||||
</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>
|
||||
<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") || "Date unavailable" %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<%= @release_notes[:body].html_safe %>
|
||||
<%= (@release_notes[:body] || "No release notes available").html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue