update draft timestamps with every edit

This commit is contained in:
Sami Samhuri 2015-04-19 21:54:32 -07:00
parent a136608ede
commit f54e5f12e5
2 changed files with 3 additions and 2 deletions

View file

@ -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

View file

@ -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