summaryrefslogtreecommitdiffstats
path: root/app/models/account.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/account.rb')
-rw-r--r--app/models/account.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index a573365de21..994459338b0 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -111,7 +111,6 @@ class Account < ApplicationRecord
scope :searchable, -> { without_suspended.where(moved_to_account_id: nil) }
scope :discoverable, -> { searchable.without_silenced.where(discoverable: true).left_outer_joins(:account_stat) }
scope :followable_by, ->(account) { joins(arel_table.join(Follow.arel_table, Arel::Nodes::OuterJoin).on(arel_table[:id].eq(Follow.arel_table[:target_account_id]).and(Follow.arel_table[:account_id].eq(account.id))).join_sources).where(Follow.arel_table[:id].eq(nil)).joins(arel_table.join(FollowRequest.arel_table, Arel::Nodes::OuterJoin).on(arel_table[:id].eq(FollowRequest.arel_table[:target_account_id]).and(FollowRequest.arel_table[:account_id].eq(account.id))).join_sources).where(FollowRequest.arel_table[:id].eq(nil)) }
- scope :tagged_with, ->(tag) { joins(:accounts_tags).where(accounts_tags: { tag_id: tag }) }
scope :by_recent_status, -> { order(Arel.sql('(case when account_stats.last_status_at is null then 1 else 0 end) asc, account_stats.last_status_at desc, accounts.id desc')) }
scope :by_recent_sign_in, -> { order(Arel.sql('(case when users.current_sign_in_at is null then 1 else 0 end) asc, users.current_sign_in_at desc, accounts.id desc')) }
scope :popular, -> { order('account_stats.followers_count desc') }
@@ -279,19 +278,13 @@ class Account < ApplicationRecord
if hashtags_map.key?(tag.name)
hashtags_map.delete(tag.name)
else
- transaction do
- tags.delete(tag)
- tag.decrement_count!(:accounts_count)
- end
+ tags.delete(tag)
end
end
# Add hashtags that were so far missing
hashtags_map.each_value do |tag|
- transaction do
- tags << tag
- tag.increment_count!(:accounts_count)
- end
+ tags << tag
end
end