diff --git a/app/queries/posts/microformat_post.rb b/app/queries/posts/microformat_post.rb index 361e15c..d5f72e6 100644 --- a/app/queries/posts/microformat_post.rb +++ b/app/queries/posts/microformat_post.rb @@ -9,7 +9,7 @@ module Adamantium def call(url:, properties:) slug = URI(url).path.split("/").last - post = post_repo.fetch!(slug) + post = post_repo.fetch_unpublished!(slug) markdown_content = ReverseMarkdown.convert(post.content, unknown_tags: :pass_through, github_flavored: true).to_s if properties.nil? || properties.empty? diff --git a/app/repos/post_repo.rb b/app/repos/post_repo.rb index dd50bd9..4f7c5c8 100644 --- a/app/repos/post_repo.rb +++ b/app/repos/post_repo.rb @@ -161,6 +161,13 @@ module Adamantium .one! end + def fetch_unpublished!(slug) + posts + .combine(:tags) + .where(slug: slug) + .one! + end + def find!(id) posts .by_pk(id)