about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2017-11-21 05:17:12 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2017-11-21 05:17:12 +0000
commit8f3e5f612826b09130cfca2a301f7963f77ee2e7 (patch)
tree4cc1988c3ac265a105f7d7a13da4a363ff9be740 /app
parenta36a2c17964ee4cb3b1d6471769e765db0d9f90d (diff)
parent6f609dc4b4d5a25ab39bee462177a934360f4991 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'app')
-rw-r--r--app/services/fetch_link_card_service.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb
index 14c21b6cc..37cf75379 100644
--- a/app/services/fetch_link_card_service.rb
+++ b/app/services/fetch_link_card_service.rb
@@ -74,6 +74,9 @@ class FetchLinkCardService < BaseService
 
     return false unless response.respond_to?(:type)
 
+    # The photo will change the URL. So, to avoid duplication of URLs, PreviewCard needs to be checked again.
+    @card = PreviewCard.find_by(url: response.url) || @card if response.type == 'photo'
+
     @card.type          = response.type
     @card.title         = response.respond_to?(:title)         ? response.title         : ''
     @card.author_name   = response.respond_to?(:author_name)   ? response.author_name   : ''