mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-27 10:30:15 -05:00
When posting a status or reblogging one, ping hubs about the feed update
This commit is contained in:
parent
ad5ae3f60e
commit
8fada4fae2
@ -65,6 +65,11 @@ class Account < ActiveRecord::Base
|
|||||||
@subscription ||= OStatus2::Subscription.new(self.remote_url, secret: self.secret, token: self.verify_token, webhook: webhook_url, hub: self.hub_url)
|
@subscription ||= OStatus2::Subscription.new(self.remote_url, secret: self.secret, token: self.verify_token, webhook: webhook_url, hub: self.hub_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ping!(atom_url, hubs)
|
||||||
|
return unless local?
|
||||||
|
OStatus2::Publication.new(atom_url, hubs).publish
|
||||||
|
end
|
||||||
|
|
||||||
def avatar_remote_url=(url)
|
def avatar_remote_url=(url)
|
||||||
self.avatar = URI.parse(url)
|
self.avatar = URI.parse(url)
|
||||||
@avatar_remote_url = url
|
@avatar_remote_url = url
|
||||||
|
@ -7,6 +7,7 @@ class PostStatusService < BaseService
|
|||||||
def call(account, text, in_reply_to = nil)
|
def call(account, text, in_reply_to = nil)
|
||||||
status = account.statuses.create!(text: text, thread: in_reply_to)
|
status = account.statuses.create!(text: text, thread: in_reply_to)
|
||||||
process_mentions_service.(status)
|
process_mentions_service.(status)
|
||||||
|
account.ping!(atom_user_stream_url(id: account.id), HUB_URL)
|
||||||
status
|
status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ class ReblogService < BaseService
|
|||||||
# @return [Status]
|
# @return [Status]
|
||||||
def call(account, reblogged_status)
|
def call(account, reblogged_status)
|
||||||
reblog = account.statuses.create!(reblog: reblogged_status, text: '')
|
reblog = account.statuses.create!(reblog: reblogged_status, text: '')
|
||||||
|
account.ping!(atom_user_stream_url(id: account.id), HUB_URL)
|
||||||
return reblog if reblogged_status.local?
|
return reblog if reblogged_status.local?
|
||||||
send_interaction_service.(reblog.stream_entry, reblogged_status.account)
|
send_interaction_service.(reblog.stream_entry, reblogged_status.account)
|
||||||
reblog
|
reblog
|
||||||
|
@ -107,4 +107,8 @@ RSpec.describe Account, type: :model do
|
|||||||
expect(subject.content).to eql subject.note
|
expect(subject.content).to eql subject.note
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#ping!' do
|
||||||
|
pending
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user