mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
update draft timestamps with every edit
This commit is contained in:
parent
a136608ede
commit
f54e5f12e5
2 changed files with 3 additions and 2 deletions
|
|
@ -114,10 +114,11 @@ class HarpBlog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_post(post, title, body, link)
|
def update_post(post, title, body, link, timestamp = nil)
|
||||||
post.title = title
|
post.title = title
|
||||||
post.body = body
|
post.body = body
|
||||||
post.link = link
|
post.link = link
|
||||||
|
post.timestamp = timestamp if timestamp
|
||||||
save_post('update post', post)
|
save_post('update post', post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ put '/posts/drafts/:id' do |id|
|
||||||
title, body, link = @fields.values_at('title', 'body', 'link')
|
title, body, link = @fields.values_at('title', 'body', 'link')
|
||||||
begin
|
begin
|
||||||
if post = blog.get_draft(id)
|
if post = blog.get_draft(id)
|
||||||
blog.update_post(post, title, body, link)
|
blog.update_post(post, title, body, link, Time.now.to_i)
|
||||||
status 204
|
status 204
|
||||||
else
|
else
|
||||||
status 404
|
status 404
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue