Fix remove group status

This commit is contained in:
noellabo 2020-10-05 22:08:54 +09:00
parent c1b9b8dbc5
commit 020074c188
2 changed files with 11 additions and 10 deletions

View file

@ -76,7 +76,7 @@ class BatchedRemoveStatusService < BaseService
def unpush_from_group_timelines(status)
return unless status.account.group?
payload = Oj.dump(event: :delete, payload: status.reblog.id.to_s)
payload = Oj.dump(event: :delete, payload: status.reblog? ? status.reblog.id.to_s : status.id.to_s)
redis.publish("timeline:group:#{status.account.id}", payload)

View file

@ -11,11 +11,10 @@ class RemoveStatusService < BaseService
# @option [Boolean] :immediate
# @option [Boolean] :original_removed
def call(status, **options)
@payload = Oj.dump(event: :delete, payload: status.id.to_s)
@reblog_payload = Oj.dump(event: :delete, payload: status.reblog.id.to_s) if status.reblog
@status = status
@account = status.account
@options = options
@payload = Oj.dump(event: :delete, payload: status.id.to_s)
@status = status
@account = status.account
@options = options
@status.discard
@ -122,17 +121,19 @@ class RemoveStatusService < BaseService
end
def remove_from_group
redis.publish("timeline:group:#{@status.account.id}", @reblog_payload)
payload = @status.reblog? ? Oj.dump(event: :delete, payload: @status.reblog.id.to_s) : @payload
redis.publish("timeline:group:#{@status.account.id}", payload)
@status.tags.map(&:name).each do |hashtag|
redis.publish("timeline:group:#{@status.account.id}:#{hashtag.mb_chars.downcase}", @reblog_payload)
redis.publish("timeline:group:#{@status.account.id}:#{hashtag.mb_chars.downcase}", payload)
end
if @status.media_attachments.any?
redis.publish("timeline:group:media:#{@status.account.id}", @reblog_payload)
redis.publish("timeline:group:media:#{@status.account.id}", payload)
@status.tags.map(&:name).each do |hashtag|
redis.publish("timeline:group:media:#{@status.account.id}:#{hashtag.mb_chars.downcase}", @reblog_payload)
redis.publish("timeline:group:media:#{@status.account.id}:#{hashtag.mb_chars.downcase}", payload)
end
end
end