about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb4
-rw-r--r--app/models/tombstone.rb16
-rw-r--r--app/models/user.rb3
3 files changed, 20 insertions, 3 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index e709b16c8..4566c0d20 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -504,7 +504,7 @@ class Status < ApplicationRecord
     return if direct_visibility?
 
     account&.increment_count!(:statuses_count)
-    reblog&.increment_count!(:reblogs_count) if reblog?
+    reblog&.increment_count!(:reblogs_count) if reblog? && (public_visibility? || unlisted_visibility?)
     thread&.increment_count!(:replies_count) if in_reply_to_id.present? && (public_visibility? || unlisted_visibility?)
   end
 
@@ -512,7 +512,7 @@ class Status < ApplicationRecord
     return if direct_visibility? || marked_for_mass_destruction?
 
     account&.decrement_count!(:statuses_count)
-    reblog&.decrement_count!(:reblogs_count) if reblog?
+    reblog&.decrement_count!(:reblogs_count) if reblog? && (public_visibility? || unlisted_visibility?)
     thread&.decrement_count!(:replies_count) if in_reply_to_id.present? && (public_visibility? || unlisted_visibility?)
   end
 
diff --git a/app/models/tombstone.rb b/app/models/tombstone.rb
new file mode 100644
index 000000000..997bb65fd
--- /dev/null
+++ b/app/models/tombstone.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+# == Schema Information
+#
+# Table name: tombstones
+#
+#  id         :bigint(8)        not null, primary key
+#  account_id :bigint(8)
+#  uri        :string           not null
+#  created_at :datetime         not null
+#  updated_at :datetime         not null
+#
+
+class Tombstone < ApplicationRecord
+  belongs_to :account
+end
diff --git a/app/models/user.rb b/app/models/user.rb
index 83ccce948..0425c1772 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -362,7 +362,8 @@ class User < ApplicationRecord
   end
 
   def regenerate_feed!
-    Redis.current.setnx("account:#{account_id}:regeneration", true) && Redis.current.expire("account:#{account_id}:regeneration", 1.day.seconds)
+    return unless Redis.current.setnx("account:#{account_id}:regeneration", true)
+    Redis.current.expire("account:#{account_id}:regeneration", 1.day.seconds)
     RegenerationWorker.perform_async(account_id)
   end