Prevented error when media item doesn't have description (#274)

This commit is contained in:
Kieran 2024-05-29 13:52:43 -07:00 committed by GitHub
parent e751c65424
commit 3dd901ff3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -43,7 +43,7 @@
</.subtle_link>
</span>
</div>
<div class="mt-4 text-bodydark">
<div :if={@media_item.description} class="mt-4 text-bodydark">
<.break_on_newline text={@media_item.description} />
</div>
</aside>

View file

@ -14,6 +14,13 @@ defmodule PinchflatWeb.MediaItemControllerTest do
assert html_response(conn, 200) =~ "#{media_item.title}"
end
test "renders the page when the media item has no description", %{conn: conn} do
media_item = media_item_with_attachments(%{description: nil})
conn = get(conn, ~p"/sources/#{media_item.source_id}/media/#{media_item}")
assert html_response(conn, 200) =~ "#{media_item.title}"
end
end
describe "edit media" do