Change link previews to keep original URL from the status (#27312)
This commit is contained in:
parent
9dc3ce878b
commit
0d14fcebae
19 changed files with 70 additions and 30 deletions
|
@ -19,7 +19,7 @@ class FetchLinkCardService < BaseService
|
|||
@status = status
|
||||
@original_url = parse_urls
|
||||
|
||||
return if @original_url.nil? || @status.preview_cards.any?
|
||||
return if @original_url.nil? || @status.with_preview_card?
|
||||
|
||||
@url = @original_url.to_s
|
||||
|
||||
|
@ -62,9 +62,9 @@ class FetchLinkCardService < BaseService
|
|||
|
||||
def attach_card
|
||||
with_redis_lock("attach_card:#{@status.id}") do
|
||||
return if @status.preview_cards.any?
|
||||
return if @status.with_preview_card?
|
||||
|
||||
@status.preview_cards << @card
|
||||
PreviewCardsStatus.create(status: @status, preview_card: @card, url: @original_url)
|
||||
Rails.cache.delete(@status)
|
||||
Trends.links.register(@status)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue