diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-11-29 23:46:53 -0600 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-11-29 23:46:53 -0600 |
commit | 1ac5226b10d7cbf801cb95553707a20a412f42be (patch) | |
tree | 5b658f96b5f8228ac46a3702ecc3f0c9cd8eeb04 /app/services | |
parent | 2711b6f523807dd1b2f1f8a7d5ce71595b5b12bb (diff) |
Allow republishing monsterfork-2020-11-29
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/publish_status_service.rb | 11 | ||||
-rw-r--r-- | app/services/update_status_service.rb | 1 |
2 files changed, 7 insertions, 5 deletions
diff --git a/app/services/publish_status_service.rb b/app/services/publish_status_service.rb index e95c3dacd..351bcd7f3 100644 --- a/app/services/publish_status_service.rb +++ b/app/services/publish_status_service.rb @@ -3,26 +3,27 @@ class PublishStatusService < BaseService include Redisable def call(status) - return if status.published? - - @status = status + @status = status + republishing = status.published? + status.notify = false if republishing update_status! reset_status_caches distribute - bump_potential_friendship! + bump_potential_friendship! unless republishing end private def update_status! - @status.update!(published: true, publish_at: nil, expires_at: @status.expires_at.blank? ? nil : Time.now.utc + (@status.expires_at - @status.created_at)) + @status.update!(published: true, publish_at: nil, created_at: Time.now.utc - 1.second, expires_at: @status.expires_at.blank? ? nil : Time.now.utc + (@status.expires_at - @status.created_at)) ProcessMentionsService.new.call(@status) end def reset_status_caches Rails.cache.delete_matched("statuses/#{@status.id}-*") Rails.cache.delete("statuses/#{@status.id}") + Rails.cache.delete("statuses/*:#{@status.id}") Rails.cache.delete(@status) Rails.cache.delete_matched("format:#{@status.id}:*") redis.zremrangebyscore("spam_check:#{@status.account.id}", @status.id, @status.id) diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb index 1765f95cc..1f5876353 100644 --- a/app/services/update_status_service.rb +++ b/app/services/update_status_service.rb @@ -141,6 +141,7 @@ class UpdateStatusService < BaseService def reset_status_caches Rails.cache.delete_matched("statuses/#{@status.id}-*") Rails.cache.delete("statuses/#{@status.id}") + Rails.cache.delete("statuses/*:#{@status.id}") Rails.cache.delete(@status) Rails.cache.delete_matched("format:#{@status.id}:*") redis.zremrangebyscore("spam_check:#{@account.id}", @status.id, @status.id) |