]> cat aescling's git repositories - mastodon.git/commitdiff
Store preview image for embedded photo in preview cards (#5986)
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Tue, 12 Dec 2017 14:54:38 +0000 (23:54 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 12 Dec 2017 14:54:38 +0000 (15:54 +0100)
The preview image would be useful to embed in timeline.

app/services/fetch_link_card_service.rb

index 9f0c7385824ff07f8a88219439cbb28267a48d33..09534d0ff032193e83e76e393e70a8f3a2a9b1aa 100644 (file)
@@ -89,6 +89,7 @@ class FetchLinkCardService < BaseService
     when 'photo'
       return false unless response.respond_to?(:url)
       @card.embed_url = response.url
+      @card.image     = URI.parse(response.url)
       @card.width     = response.width.presence  || 0
       @card.height    = response.height.presence || 0
     when 'video'