Skip to content

Commit

Permalink
MAM-4121-show-link-card-when-quote-post-cant-load (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnolens authored Apr 19, 2024
1 parent aa5909a commit 337b6fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Mammoth/Models/PostCardModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,12 @@ final class PostCardModel {
// Hide the link image if there is a media attachment
self.hideLinkImage = true //self.hasMediaAttachment

// Contains quote post?
self.hasQuotePost = (status.reblog?.quotePostCard() ?? status.quotePostCard()) != nil

// Quote post card
self.quotePostCard = status.reblog?.quotePostCard() ?? status.quotePostCard()

// Contains quote post?
self.hasQuotePost = self.quotePostCard != nil

// Quote post status data
if self.hasQuotePost {
if let urlStr = self.quotePostCard?.url,
Expand Down
8 changes: 4 additions & 4 deletions Mammoth/Views/Cells/PostCardCell/PostCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ extension PostCardCell {
}

// Display the quote post preview if needed
if postCard.hasQuotePost {
if postCard.hasQuotePost && postCard.quotePostStatus != .notFound {
self.quotePost?.configure(postCard: postCard)
self.quotePost?.onPress = onButtonPress
self.quotePost?.isHidden = false
Expand All @@ -903,7 +903,7 @@ extension PostCardCell {
}

// Display the link preview if needed
if postCard.hasLink && !postCard.hasQuotePost {
if postCard.hasLink && (!postCard.hasQuotePost || postCard.quotePostStatus == .notFound ) {
self.linkPreview?.configure(postCard: postCard)
self.linkPreview?.onPress = onButtonPress
self.linkPreview?.isHidden = false
Expand Down Expand Up @@ -1126,7 +1126,7 @@ extension PostCardCell {
}

// Display the quote post preview if needed
if postCard.hasQuotePost {
if postCard.hasQuotePost && postCard.quotePostStatus != .notFound {
if let constraint = self.quotePostTrailingConstraint, !constraint.isActive {
NSLayoutConstraint.activate([self.quotePostTrailingConstraint!])
}
Expand All @@ -1137,7 +1137,7 @@ extension PostCardCell {
}

// Display the link preview if needed
if postCard.hasLink && !postCard.hasQuotePost {
if postCard.hasLink && (!postCard.hasQuotePost || postCard.quotePostStatus == .notFound ) {
if let constraint = self.linkPreviewTrailingConstraint, !constraint.isActive {
NSLayoutConstraint.activate([constraint])
}
Expand Down

0 comments on commit 337b6fd

Please sign in to comment.