aboutsummaryrefslogtreecommitdiff
path: root/src/display
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-12-01 01:48:32 -0800
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-12-01 01:48:32 -0800
commitbbe0e891a7cbb0708e2689b8123bb65a6d8ac7e0 (patch)
tree6e13adb9cbab7b5fd8d5635d25c01f3c7a027ce9 /src/display
parent8ad1d470a11dfe99d28a4f5228a3fef335f692d1 (diff)
display locked and protected as applicable
Diffstat (limited to 'src/display')
-rw-r--r--src/display/mod.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs
index 4a0f198..c3c4692 100644
--- a/src/display/mod.rs
+++ b/src/display/mod.rs
@@ -632,6 +632,14 @@ fn pad_lines(lines: Vec<String>, padding: &str) -> Vec<String> {
lines.into_iter().map(|x| format!("{}{}", padding, x)).collect()
}
+fn short_display_summary(u: &tw::user::User) -> String {
+ format!("{}{}{} ({}@{}{}{})",
+ color_for(&u.handle), u.name, color::Fg(color::Reset),
+ color_for(&u.handle), u.handle, color::Fg(color::Reset),
+ if u.verified { format!(" {}✔️{}", color::Fg(color::Blue), color::Fg(color::Reset)) } else { "".to_owned() }
+ )
+}
+
pub fn render_twete(twete_id: &TweetId, tweeter: &tw::TwitterCache, display_info: &mut DisplayInfo, width: Option<u16>) -> Vec<String> {
let mut lines = render_twete_no_recurse(twete_id, tweeter, display_info, width);
match tweeter.retrieve_tweet(twete_id).map(|x| x.clone()) {
@@ -678,7 +686,11 @@ pub fn render_twete_no_recurse(twete_id: &TweetId, tweeter: &tw::TwitterCache, d
// of the retweeter tweet if it's there
let mut id_string = format!("{}id {}", id_color, tweet_id);
- let mut author_string = format!("{}{}{} ({}@{}{})", color_for(&tweet_author.handle), tweet_author.name, color::Fg(color::Reset), color_for(&tweet_author.handle), tweet_author.handle, color::Fg(color::Reset));
+ let mut author_string = short_display_summary(&tweet_author);
+
+ if tweet_author.protected {
+ id_string.push_str(&format!(" {}locked{}", termion::style::Underline, termion::style::Reset));
+ }
if let Some(reply_id) = tweet.reply_to_tweet.clone() {
let reply_tweet_id = tweeter.display_id_for_tweet_id(&TweetId::Twitter(reply_id.to_owned()));
@@ -690,7 +702,7 @@ pub fn render_twete_no_recurse(twete_id: &TweetId, tweeter: &tw::TwitterCache, d
let rt_id = tweeter.display_id_for_tweet(&rt);
let rt_author = tweeter.retrieve_user(&rt.author_id).unwrap().clone();
id_string.push_str(&format!(" (rt id {})", rt_id));
- author_string.push_str(&format!(" via {}{}{} ({}@{}{}) RT", color_for(&rt_author.handle), rt_author.name, color::Fg(color::Reset), color_for(&rt_author.handle), rt_author.handle, color::Fg(color::Reset)));
+ author_string.push_str(&format!(" via {} RT", short_display_summary(&rt_author)));
}
id_string.push_str(&format!("{}", color::Fg(color::Reset)));