FEATURE: update TwitterApi for prettifying like/retweet count

This commit is contained in:
Arpit Jalan 2018-07-17 12:59:40 +05:30
parent 9f1e8d4f58
commit 7c7509e1bd
2 changed files with 13 additions and 0 deletions

View File

@ -530,6 +530,14 @@ aside.onebox.stackexchange .onebox-body {
}
}
.onebox.twitterstatus {
.like,
.retweet {
color: dark-light-choose($primary-medium, $secondary-medium);
padding-left: 10px;
}
}
// mobile specific style
.mobile-view article.onebox-body {
border-top: none;

View File

@ -2,6 +2,7 @@
class TwitterApi
class << self
include ActionView::Helpers::NumberHelper
def prettify_tweet(tweet)
text = tweet["full_text"].dup
@ -32,6 +33,10 @@ class TwitterApi
result
end
def prettify_number(count)
number_to_human(count, :format => '%n%u', :precision => 2, :units => { :thousand => 'K', :million => 'M', :billion => 'B' })
end
def user_timeline(screen_name)
JSON.parse(twitter_get(user_timeline_uri_for screen_name))
end