Skip to content

Commit

Permalink
Adding more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Nov 8, 2016
1 parent cff0b03 commit b683255
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/services/process_feed_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ def create_status
if verb == :share
original_status = status_from_xml(@xml.at_xpath('.//activity:object', activity: ACTIVITY_NS))
status.reblog = original_status

if original_status.nil?
status.destroy
return nil
end
end

status.save!
Expand All @@ -68,15 +73,22 @@ def status_from_xml(entry)
status = find_status(id(entry))
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!({
uri: id(entry),
url: url(entry),
account: account?(entry) ? find_or_resolve_account(acct(entry)) : @account,
account: account,
text: content(entry),
created_at: published(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))
end

Expand Down Expand Up @@ -136,7 +148,7 @@ def mentions_from_xml(parent, xml)
end

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)
end

Expand Down

0 comments on commit b683255

Please sign in to comment.