about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-02-17 14:28:48 +0100
committerGitHub <noreply@github.com>2018-02-17 14:28:48 +0100
commita71af984011ff98df2fa1b7f6c983706a91d99bf (patch)
treef949ab587ba0d65ad0c08a3417f8d5110c53ca6a /app/models
parenta7c50c7abab98b3db0b89e3b2fe78abe0dc9789c (diff)
Push discovered status through streaming API within a time window (#6484)
Time window of 6 hours
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 0de89ad4e..8186f4784 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -80,6 +80,8 @@ class Status < ApplicationRecord
 
   delegate :domain, to: :account, prefix: true
 
+  REAL_TIME_WINDOW = 6.hours
+
   def searchable_by(preloaded = nil)
     ids = [account_id]
 
@@ -108,6 +110,10 @@ class Status < ApplicationRecord
     !reblog_of_id.nil?
   end
 
+  def within_realtime_window?
+    created_at >= REAL_TIME_WINDOW.ago
+  end
+
   def verb
     if destroyed?
       :delete