mirror of
https://github.com/kikobar/mastodon.git
synced 2024-12-24 23:04:14 +00:00
Adding more logging
This commit is contained in:
parent
cff0b03cbb
commit
b6832553ff
|
@ -44,6 +44,11 @@ class ProcessFeedService < BaseService
|
||||||
if verb == :share
|
if verb == :share
|
||||||
original_status = status_from_xml(@xml.at_xpath('.//activity:object', activity: ACTIVITY_NS))
|
original_status = status_from_xml(@xml.at_xpath('.//activity:object', activity: ACTIVITY_NS))
|
||||||
status.reblog = original_status
|
status.reblog = original_status
|
||||||
|
|
||||||
|
if original_status.nil?
|
||||||
|
status.destroy
|
||||||
|
return nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
status.save!
|
status.save!
|
||||||
|
@ -68,15 +73,22 @@ class ProcessFeedService < BaseService
|
||||||
status = find_status(id(entry))
|
status = find_status(id(entry))
|
||||||
return status unless status.nil?
|
return status unless status.nil?
|
||||||
|
|
||||||
|
begin
|
||||||
|
account = account?(entry) ? find_or_resolve_account(acct(entry)) : @account
|
||||||
|
rescue Goldfinger::Error
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
status = Status.create!({
|
status = Status.create!({
|
||||||
uri: id(entry),
|
uri: id(entry),
|
||||||
url: url(entry),
|
url: url(entry),
|
||||||
account: account?(entry) ? find_or_resolve_account(acct(entry)) : @account,
|
account: account,
|
||||||
text: content(entry),
|
text: content(entry),
|
||||||
created_at: published(entry),
|
created_at: published(entry),
|
||||||
})
|
})
|
||||||
|
|
||||||
if thread?(entry)
|
if thread?(entry)
|
||||||
|
Rails.logger.debug "Trying to attach #{status.id} (#{id(entry)}) to #{thread(entry).first}"
|
||||||
status.thread = find_or_resolve_status(status, *thread(entry))
|
status.thread = find_or_resolve_status(status, *thread(entry))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -136,7 +148,7 @@ class ProcessFeedService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def hashtags_from_xml(parent, xml)
|
def hashtags_from_xml(parent, xml)
|
||||||
tags = xml.xpath('./xmlns:category').map { |category| category['term'] }
|
tags = xml.xpath('./xmlns:category').map { |category| category['term'] }.select { |t| !t.blank? }
|
||||||
ProcessHashtagsService.new.call(parent, tags)
|
ProcessHashtagsService.new.call(parent, tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue