Skip to content

Commit b73f91d

Browse files
authored
Fix phantom alert messages with empty body (#140)
Allow only string msgs when rendering flashes
1 parent 4cac288 commit b73f91d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

app/views/layouts/signed_in_application.html.erb

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
<body>
2020

21-
<%#= yield :exceptions %>
22-
2321
<div class="flex h-screen overflow-hidden">
2422
<%= render partial: 'shared/sidebar', locals: { active_apps: current_organization.apps.with_trains } %>
2523
<div class="relative flex flex-col flex-1 overflow-y-auto overflow-x-hidden">

app/views/shared/_flash.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div data-controller="alert">
2-
<% flash.each do |name, msg| %>
2+
<% flash.select { |_, msg| msg.is_a?(String) }.each do |name, msg| %>
33
<div class="inline-flex min-w-80 px-4 py-2 mb-6 rounded-sm text-sm bg-indigo-100 border border-indigo-200 text-indigo-500"
44
data-alert-target="alert">
55
<div class="flex w-full justify-between items-start">
@@ -8,7 +8,7 @@
88
<path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm1 12H7V7h2v5zM8 6c-.6 0-1-.4-1-1s.4-1 1-1 1 .4 1 1-.4 1-1 1z"/>
99
</svg>
1010

11-
<%= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String) %>
11+
<%= content_tag :div, msg, :id => "flash_#{name}" %>
1212
</div>
1313

1414
<button class="opacity-70 hover:opacity-80 ml-3 mt-[3px]" data-action="alert#close">

0 commit comments

Comments
 (0)