Render content when updating posts
This commit is contained in:
@@ -2,14 +2,14 @@ module Adamantium
|
|||||||
module Commands
|
module Commands
|
||||||
module Posts
|
module Posts
|
||||||
class Update < Command
|
class Update < Command
|
||||||
include Deps["repos.post_repo"]
|
include Deps["repos.post_repo", "renderers.markdown"]
|
||||||
|
|
||||||
def call(params:)
|
def call(params:)
|
||||||
slug = URI(params[:url]).path.split("/").last
|
slug = URI(params[:url]).path.split("/").last
|
||||||
post = post_repo.fetch!(slug)
|
post = post_repo.fetch!(slug)
|
||||||
|
|
||||||
if params.key? :replace
|
if params.key? :replace
|
||||||
post_repo.update(post.id, params)
|
post_repo.update(post.id, {content: markdown.call(content: params[:content])})
|
||||||
end
|
end
|
||||||
|
|
||||||
if params.key? :add
|
if params.key? :add
|
||||||
|
Reference in New Issue
Block a user