diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-01-19 18:28:37 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-01-19 18:28:37 +0100 |
commit | 5e0cf92fd145b27053389e5ffcce48da77439713 (patch) | |
tree | 27e1567b240f1a3117de595413ccceb9222d8465 /app/models | |
parent | 530d29148ca0c5bf29f6fa516b1ef4f91d95894b (diff) | |
parent | 7c3fddeab4c4ddebca7d5441ac67870aa1cecfe4 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
No conflicts.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 4 | ||||
-rw-r--r-- | app/models/tombstone.rb | 16 | ||||
-rw-r--r-- | app/models/user.rb | 3 |
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 |