Allow direct access to draft and scheduled posts by slug

This commit is contained in:
Willem van den Ende
2026-04-01 20:39:19 +00:00
parent 370275f7b5
commit 20f12847d6
5 changed files with 23 additions and 11 deletions
+2 -2
View File
@@ -105,13 +105,13 @@ defmodule Blogex.Blog do
@doc "Returns a single post by slug/id, or raises."
def get_post!(id) do
Enum.find(all_posts(), &(&1.id == id)) ||
Enum.find(unfiltered_posts(), &(&1.id == id)) ||
raise Blogex.NotFoundError, "post #{inspect(id)} not found in #{@blog_id}"
end
@doc "Returns a single post by slug/id, or nil."
def get_post(id) do
Enum.find(all_posts(), &(&1.id == id))
Enum.find(unfiltered_posts(), &(&1.id == id))
end
@doc "Returns paginated posts. Page is 1-indexed."