Make the retweet timestamp a link back to the original status.

This commit is contained in:
Maurice Parker 2020-04-19 20:54:11 -05:00
parent f305cc50e2
commit a54af07ec7
1 changed files with 3 additions and 1 deletions

View File

@ -105,11 +105,13 @@ private extension TwitterStatus {
func renderAsTweetHTML(_ status: TwitterStatus, topLevel: Bool) -> String {
var html = "<div>\(status.displayHTML ?? "")</div>"
if !topLevel, let createdAt = status.createdAt {
if !topLevel, let createdAt = status.createdAt, let url = status.url {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.timeStyle = .short
html += "<a href=\"\(url)\">"
html += "<div class=\"twitterTimestamp\">\(dateFormatter.string(from: createdAt))</div>"
html += "</a>"
}
return html