render unpublished note when logged in
This commit is contained in:
parent
5ab196ae16
commit
a5dd041c42
2 changed files with 5 additions and 1 deletions
|
@ -42,7 +42,7 @@ defmodule ChiyaWeb.PageController do
|
|||
def note(conn, %{"slug" => note_slug}) do
|
||||
note = Chiya.Notes.get_note_by_slug_preloaded!(note_slug)
|
||||
|
||||
if is_nil(note.published_at) do
|
||||
if is_nil(note.published_at) and is_nil(conn.assigns.current_user) do
|
||||
render_error(conn, :not_found)
|
||||
else
|
||||
render(conn, :note,
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
<%= @note.name %>
|
||||
</h1>
|
||||
<p class="mt-2 text-sm leading-6 text-theme-base">
|
||||
<%= if @note.published_at do %>
|
||||
<span>Published</span>
|
||||
<% else %>
|
||||
<span>Unpublished</span>
|
||||
<% end %>
|
||||
<time class="text-theme-primary font-semibold"><%= pretty_date(@note.published_at) %></time>
|
||||
<span>·</span>
|
||||
<span>Last Updated</span>
|
||||
|
|
Loading…
Reference in a new issue