Skip to content

Commit

Permalink
Fix phantom alert messages with empty body (#140)
Browse files Browse the repository at this point in the history
Allow only string msgs when rendering flashes
  • Loading branch information
kitallis authored Aug 16, 2022
1 parent 4cac288 commit b73f91d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions app/views/layouts/signed_in_application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

<body>

<%#= yield :exceptions %>

<div class="flex h-screen overflow-hidden">
<%= render partial: 'shared/sidebar', locals: { active_apps: current_organization.apps.with_trains } %>
<div class="relative flex flex-col flex-1 overflow-y-auto overflow-x-hidden">
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_flash.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div data-controller="alert">
<% flash.each do |name, msg| %>
<% flash.select { |_, msg| msg.is_a?(String) }.each do |name, msg| %>
<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"
data-alert-target="alert">
<div class="flex w-full justify-between items-start">
Expand All @@ -8,7 +8,7 @@
<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"/>
</svg>

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

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

0 comments on commit b73f91d

Please sign in to comment.