about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/javascript/flavours/glitch/components/status_action_bar.js3
-rw-r--r--app/lib/command_tag/processor.rb1
-rw-r--r--app/services/publish_status_service.rb11
-rw-r--r--app/services/update_status_service.rb1
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)