mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-25 07:23:43 +01:00
Status removal is broadcast to public/hashtag timelines too
This commit is contained in:
parent
448ab18a20
commit
c5e03a2e0d
2 changed files with 17 additions and 2 deletions
|
@ -4,6 +4,9 @@ module ApplicationCable
|
||||||
|
|
||||||
def hydrate_status(encoded_message)
|
def hydrate_status(encoded_message)
|
||||||
message = ActiveSupport::JSON.decode(encoded_message)
|
message = ActiveSupport::JSON.decode(encoded_message)
|
||||||
|
|
||||||
|
return [nil, message] if message['type'] == 'delete'
|
||||||
|
|
||||||
status = Status.find_by(id: message['id'])
|
status = Status.find_by(id: message['id'])
|
||||||
message['message'] = FeedManager.instance.inline_render(current_user.account, status)
|
message['message'] = FeedManager.instance.inline_render(current_user.account, status)
|
||||||
|
|
||||||
|
@ -11,7 +14,7 @@ module ApplicationCable
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter?(status)
|
def filter?(status)
|
||||||
status.nil? || current_user.account.blocking?(status.account) || (status.reblog? && current_user.account.blocking?(status.reblog.account))
|
!status.nil? && (current_user.account.blocking?(status.account) || (status.reblog? && current_user.account.blocking?(status.reblog.account)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,8 @@ class RemoveStatusService < BaseService
|
||||||
remove_from_followers(status)
|
remove_from_followers(status)
|
||||||
remove_from_mentioned(status)
|
remove_from_mentioned(status)
|
||||||
remove_reblogs(status)
|
remove_reblogs(status)
|
||||||
|
remove_from_hashtags(status)
|
||||||
|
remove_from_public(status)
|
||||||
|
|
||||||
status.destroy!
|
status.destroy!
|
||||||
end
|
end
|
||||||
|
@ -49,6 +51,16 @@ class RemoveStatusService < BaseService
|
||||||
FeedManager.instance.broadcast(receiver.id, type: 'delete', id: status.id)
|
FeedManager.instance.broadcast(receiver.id, type: 'delete', id: status.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_from_hashtags(status)
|
||||||
|
status.tags.each do |tag|
|
||||||
|
FeedManager.instance.broadcast("hashtag:#{tag.name}", type: 'delete', id: status.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_from_public(status)
|
||||||
|
FeedManager.instance.broadcast(:public, type: 'delete', id: status.id)
|
||||||
|
end
|
||||||
|
|
||||||
def redis
|
def redis
|
||||||
$redis
|
$redis
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue