Add video attribution link support
This commit is contained in:
@@ -264,6 +264,7 @@ type
|
|||||||
stats*: TweetStats
|
stats*: TweetStats
|
||||||
retweet*: Option[Tweet]
|
retweet*: Option[Tweet]
|
||||||
attribution*: Option[User]
|
attribution*: Option[User]
|
||||||
|
attributionLink*: string
|
||||||
mediaTags*: seq[User]
|
mediaTags*: seq[User]
|
||||||
quote*: Option[Tweet]
|
quote*: Option[Tweet]
|
||||||
card*: Option[Card]
|
card*: Option[Card]
|
||||||
|
|||||||
+4
-3
@@ -239,8 +239,9 @@ proc renderReply(tweet: Tweet): VNode =
|
|||||||
if i > 0: text " "
|
if i > 0: text " "
|
||||||
a(href=("/" & u)): text "@" & u
|
a(href=("/" & u)): text "@" & u
|
||||||
|
|
||||||
proc renderAttribution(user: User; prefs: Prefs): VNode =
|
proc renderAttribution(user: User; prefs: Prefs; link = ""): VNode =
|
||||||
buildHtml(a(class="attribution", href=("/" & user.username))):
|
let href = if link.len > 0: link else: "/" & user.username
|
||||||
|
buildHtml(a(class="attribution", href=href)):
|
||||||
renderMiniAvatar(user, prefs)
|
renderMiniAvatar(user, prefs)
|
||||||
strong: text user.fullname
|
strong: text user.fullname
|
||||||
verifiedIcon(user)
|
verifiedIcon(user)
|
||||||
@@ -386,7 +387,7 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0;
|
|||||||
verbatim replaceUrls(tweet.text, prefs) & renderLocation(tweet)
|
verbatim replaceUrls(tweet.text, prefs) & renderLocation(tweet)
|
||||||
|
|
||||||
if tweet.attribution.isSome:
|
if tweet.attribution.isSome:
|
||||||
renderAttribution(tweet.attribution.get(), prefs)
|
renderAttribution(tweet.attribution.get(), prefs, tweet.attributionLink)
|
||||||
|
|
||||||
if tweet.card.isSome and tweet.card.get().kind != hidden:
|
if tweet.card.isSome and tweet.card.get().kind != hidden:
|
||||||
renderCard(tweet.card.get(), prefs, path)
|
renderCard(tweet.card.get(), prefs, path)
|
||||||
|
|||||||
Reference in New Issue
Block a user