mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +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
|
||||
|
||||
def update_post(post, title, body, link)
|
||||
def update_post(post, title, body, link, timestamp = nil)
|
||||
post.title = title
|
||||
post.body = body
|
||||
post.link = link
|
||||
post.timestamp = timestamp if timestamp
|
||||
save_post('update post', post)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ put '/posts/drafts/:id' do |id|
|
|||
title, body, link = @fields.values_at('title', 'body', 'link')
|
||||
begin
|
||||
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
|
||||
else
|
||||
status 404
|
||||
|
|
|
|||
Loading…
Reference in a new issue