mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-08 08:44:27 +00:00
Fix unfollows
This commit is contained in:
parent
9cb690c706
commit
086d487145
|
@ -2,7 +2,7 @@ class Favourite < ActiveRecord::Base
|
||||||
belongs_to :account, inverse_of: :favourites
|
belongs_to :account, inverse_of: :favourites
|
||||||
belongs_to :status, inverse_of: :favourites
|
belongs_to :status, inverse_of: :favourites
|
||||||
|
|
||||||
has_one :stream_entry, as: :activity, dependent: :destroy
|
has_one :stream_entry, as: :activity
|
||||||
|
|
||||||
def verb
|
def verb
|
||||||
:favorite
|
:favorite
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Follow < ActiveRecord::Base
|
||||||
belongs_to :account
|
belongs_to :account
|
||||||
belongs_to :target_account, class_name: 'Account'
|
belongs_to :target_account, class_name: 'Account'
|
||||||
|
|
||||||
has_one :stream_entry, as: :activity, dependent: :destroy
|
has_one :stream_entry, as: :activity
|
||||||
|
|
||||||
validates :account, :target_account, presence: true
|
validates :account, :target_account, presence: true
|
||||||
validates :account_id, uniqueness: { scope: :target_account_id }
|
validates :account_id, uniqueness: { scope: :target_account_id }
|
||||||
|
|
|
@ -21,6 +21,8 @@ class ProcessInteractionService < BaseService
|
||||||
if salmon.verify(envelope, account.keypair)
|
if salmon.verify(envelope, account.keypair)
|
||||||
update_remote_profile_service.(xml.at_xpath('/xmlns:entry/xmlns:author'), account)
|
update_remote_profile_service.(xml.at_xpath('/xmlns:entry/xmlns:author'), account)
|
||||||
|
|
||||||
|
binding.pry
|
||||||
|
|
||||||
case verb(xml)
|
case verb(xml)
|
||||||
when :follow
|
when :follow
|
||||||
follow!(account, target_account)
|
follow!(account, target_account)
|
||||||
|
@ -48,7 +50,7 @@ class ProcessInteractionService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def verb(xml)
|
def verb(xml)
|
||||||
xml.at_xpath('//activity:verb').content.gsub('http://activitystrea.ms/schema/1.0/', '').to_sym
|
xml.at_xpath('//activity:verb').content.gsub('http://activitystrea.ms/schema/1.0/', '').gsub('http://ostatus.org/schema/1.0/', '').to_sym
|
||||||
rescue
|
rescue
|
||||||
:post
|
:post
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue