From c10aa8412bd0e90eb4f47f8dc027cba8cb27e44b Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 5 Jul 2021 14:24:50 -0500 Subject: [PATCH] Changed how images are placed in Twitter articles so that you can better see who Tweeted the image. --- .../FeedProvider/Twitter/TwitterStatus.swift | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/Account/Sources/Account/FeedProvider/Twitter/TwitterStatus.swift b/Account/Sources/Account/FeedProvider/Twitter/TwitterStatus.swift index 0e86168fb..275d4b354 100644 --- a/Account/Sources/Account/FeedProvider/Twitter/TwitterStatus.swift +++ b/Account/Sources/Account/FeedProvider/Twitter/TwitterStatus.swift @@ -48,7 +48,7 @@ final class TwitterStatus: Codable { func renderAsHTML(topLevel: Bool = true) -> String { if let retweetedStatus = retweetedStatus { - return renderAsRetweetHTML(retweetedStatus, topLevel: topLevel) + return renderAsRetweetHTML(retweetedStatus) } if let quotedStatus = quotedStatus { return renderAsQuoteHTML(quotedStatus, topLevel: topLevel) @@ -139,26 +139,17 @@ private extension TwitterStatus { func renderAsOriginalHTML(topLevel: Bool) -> String { var html = renderAsTweetHTML(self, topLevel: topLevel) - if topLevel { - html += extendedEntities?.renderAsHTML() ?? "" - html += retweetedStatus?.extendedEntities?.renderAsHTML() ?? "" - html += quotedStatus?.extendedEntities?.renderAsHTML() ?? "" - } + html += extendedEntities?.renderAsHTML() ?? "" return html } - func renderAsRetweetHTML(_ status: TwitterStatus, topLevel: Bool) -> String { + func renderAsRetweetHTML(_ status: TwitterStatus) -> String { var html = "
" if let userHTML = status.user?.renderAsHTML() { html += userHTML } html += status.renderAsHTML(topLevel: false) html += "
" - if topLevel { - html += status.extendedEntities?.renderAsHTML() ?? "" - html += status.retweetedStatus?.extendedEntities?.renderAsHTML() ?? "" - html += status.quotedStatus?.extendedEntities?.renderAsHTML() ?? "" - } return html } @@ -171,11 +162,6 @@ private extension TwitterStatus { } html += quotedStatus.renderAsHTML(topLevel: false) html += "" - if topLevel { - html += quotedStatus.extendedEntities?.renderAsHTML() ?? "" - html += quotedStatus.retweetedStatus?.extendedEntities?.renderAsHTML() ?? "" - html += quotedStatus.quotedStatus?.extendedEntities?.renderAsHTML() ?? "" - } return html }