Fix for Reddit timezone

This commit is contained in:
Omar Roth 2018-09-20 11:03:58 -05:00
parent 95e2d8f1b7
commit 6e092026d2
2 changed files with 8 additions and 8 deletions

View file

@ -2055,7 +2055,7 @@ get "/api/v1/comments/:id" do |env|
end end
elsif source == "reddit" elsif source == "reddit"
client = make_client(REDDIT_URL) client = make_client(REDDIT_URL)
headers = HTTP::Headers{"User-Agent" => "web:invidio.us:v0.2.0 (by /u/omarroth)"} headers = HTTP::Headers{"User-Agent" => "web:invidio.us:v0.6.0 (by /u/omarroth)"}
begin begin
comments, reddit_thread = get_reddit_comments(id, client, headers) comments, reddit_thread = get_reddit_comments(id, client, headers)
content_html = template_reddit_comments(comments) content_html = template_reddit_comments(comments)

View file

@ -17,12 +17,12 @@ class RedditComment
end end
JSON.mapping({ JSON.mapping({
author: String, author: String,
body_html: String, body_html: String,
replies: RedditThing | String, replies: RedditThing | String,
score: Int32, score: Int32,
depth: Int32, depth: Int32,
created: { created_utc: {
type: Time, type: Time,
converter: RedditComment::TimeConverter, converter: RedditComment::TimeConverter,
}, },
@ -159,7 +159,7 @@ def template_reddit_comments(root)
<a href="javascript:void(0)" onclick="toggle(this)">[ - ]</a> <a href="javascript:void(0)" onclick="toggle(this)">[ - ]</a>
<i class="icon ion-ios-thumbs-up"></i> #{score} <i class="icon ion-ios-thumbs-up"></i> #{score}
<b><a href="https://www.reddit.com/user/#{author}">#{author}</a></b> <b><a href="https://www.reddit.com/user/#{author}">#{author}</a></b>
- #{recode_date(child.created)} ago - #{recode_date(child.created_utc)} ago
</p> </p>
<div> <div>
#{body_html} #{body_html}