Fix bug that was incorrectly parsing Twitter Symbols. Fixes #3248

This commit is contained in:
Maurice Parker 2021-08-10 20:07:38 -05:00
parent acccc4f063
commit b38ee75ba2
1 changed files with 4 additions and 4 deletions

View File

@ -10,18 +10,18 @@ import Foundation
struct TwitterSymbol: Codable, TwitterEntity { struct TwitterSymbol: Codable, TwitterEntity {
let name: String? let text: String?
let indices: [Int]? let indices: [Int]?
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case name = "name" case text = "text"
case indices = "indices" case indices = "indices"
} }
func renderAsHTML() -> String { func renderAsHTML() -> String {
var html = String() var html = String()
if let name = name { if let text = text {
html += "<a href=\"https://twitter.com/search?q=%24\(name)\">$\(name)</a>" html += "<a href=\"https://twitter.com/search?q=%24\(text)\">$\(text)</a>"
} }
return html return html
} }