Suppress any URL links that are just pointing to the quoted status.

This commit is contained in:
Maurice Parker 2020-04-20 07:27:20 -05:00
parent a54af07ec7
commit 8fcc46191a
1 changed files with 10 additions and 2 deletions

View File

@ -86,9 +86,17 @@ private extension TwitterStatus {
if prevIndex < entityStartIndex {
html += String(text[prevIndex..<entityStartIndex])
}
html += entity.renderAsHTML()
prevIndex = entityEndIndex
// We drop off any URL which is just pointing to the quoted status. It is redundant.
if let twitterURL = entity as? TwitterURL, let expandedURL = twitterURL.expandedURL, let quotedURL = quotedStatus?.url {
if expandedURL.caseInsensitiveCompare(quotedURL) != .orderedSame {
html += entity.renderAsHTML()
}
} else {
html += entity.renderAsHTML()
}
prevIndex = entityEndIndex
}
}