Fix #51 - prevent duplicate attachments for remote statuses
This commit is contained in:
parent
d09f3768b7
commit
4a670780f0
1 changed files with 4 additions and 0 deletions
|
@ -80,6 +80,10 @@ class ProcessFeedService < BaseService
|
||||||
entry.xpath('./xmlns:link[@rel="enclosure"]').each do |enclosure_link|
|
entry.xpath('./xmlns:link[@rel="enclosure"]').each do |enclosure_link|
|
||||||
next if enclosure_link.attribute('href').nil?
|
next if enclosure_link.attribute('href').nil?
|
||||||
|
|
||||||
|
media = MediaAttachment.where(status: status, remote_url: enclosure_link.attribute('href').value).first
|
||||||
|
|
||||||
|
next unless media.nil?
|
||||||
|
|
||||||
media = MediaAttachment.new(account: status.account, status: status, remote_url: enclosure_link.attribute('href').value)
|
media = MediaAttachment.new(account: status.account, status: status, remote_url: enclosure_link.attribute('href').value)
|
||||||
media.file_remote_url = enclosure_link.attribute('href').value
|
media.file_remote_url = enclosure_link.attribute('href').value
|
||||||
media.save
|
media.save
|
||||||
|
|
Loading…
Reference in a new issue