Fix some nil errors (#3338)
* Fix nil input not handled well in AuthorExtractor concern * Fix hard error in ProcessFeedService when replied-to status has been deleted * Fix nil errors in ProcessInteractionService when favourited status cannot be found
This commit is contained in:
parent
bd21afb5ed
commit
44cb08297c
3 changed files with 9 additions and 1 deletions
|
@ -108,12 +108,18 @@ class ProcessInteractionService < BaseService
|
|||
|
||||
def favourite!(xml, from_account)
|
||||
current_status = status(xml)
|
||||
|
||||
return if current_status.nil?
|
||||
|
||||
favourite = current_status.favourites.where(account: from_account).first_or_create!(account: from_account)
|
||||
NotifyService.new.call(current_status.account, favourite)
|
||||
end
|
||||
|
||||
def unfavourite!(xml, from_account)
|
||||
current_status = status(xml)
|
||||
|
||||
return if current_status.nil?
|
||||
|
||||
favourite = current_status.favourites.where(account: from_account).first
|
||||
favourite&.destroy
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue