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 | |
parent | 2711b6f523807dd1b2f1f8a7d5ce71595b5b12bb (diff) |
Allow republishing monsterfork-2020-11-29
-rw-r--r-- | app/javascript/flavours/glitch/components/status_action_bar.js | 3 | ||||
-rw-r--r-- | app/lib/command_tag/processor.rb | 1 | ||||
-rw-r--r-- | app/services/publish_status_service.rb | 11 | ||||
-rw-r--r-- | app/services/update_status_service.rb | 1 |
4 files changed, 11 insertions, 5 deletions
diff --git a/app/javascript/flavours/glitch/components/status_action_bar.js b/app/javascript/flavours/glitch/components/status_action_bar.js index b844590c0..d5a42b399 100644 --- a/app/javascript/flavours/glitch/components/status_action_bar.js +++ b/app/javascript/flavours/glitch/components/status_action_bar.js @@ -15,6 +15,7 @@ const messages = defineMessages({ redraft: { id: 'status.redraft', defaultMessage: 'Delete & re-draft' }, edit: { id: 'status.edit', defaultMessage: 'Edit' }, publish: { id: 'status.publish', defaultMessage: 'Publish' }, + republish: { id: 'status.republish', defaultMessage: 'Republish' }, direct: { id: 'status.direct', defaultMessage: 'Direct message @{name}' }, mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' }, mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' }, @@ -237,6 +238,8 @@ class StatusActionBar extends ImmutablePureComponent { if (status.get('published') === false) { menu.push({ text: intl.formatMessage(messages.publish), action: this.handlePublishClick }); + } else { + menu.push({ text: intl.formatMessage(messages.republish), action: this.handlePublishClick }); } } else { menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick }); diff --git a/app/lib/command_tag/processor.rb b/app/lib/command_tag/processor.rb index 77be29eba..7b08584ce 100644 --- a/app/lib/command_tag/processor.rb +++ b/app/lib/command_tag/processor.rb @@ -239,6 +239,7 @@ class CommandTag::Processor 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/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) |