mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-25 07:05:20 +00:00
Fix Rails/WhereExists
cop in app/services (#28853)
This commit is contained in:
parent
78ee1453f9
commit
ceade78182
|
@ -86,8 +86,6 @@ Rails/WhereExists:
|
|||
- 'app/models/status.rb'
|
||||
- 'app/policies/status_policy.rb'
|
||||
- 'app/serializers/rest/announcement_serializer.rb'
|
||||
- 'app/services/activitypub/fetch_remote_status_service.rb'
|
||||
- 'app/services/vote_service.rb'
|
||||
- 'app/workers/move_worker.rb'
|
||||
- 'spec/models/account_spec.rb'
|
||||
- 'spec/services/activitypub/process_collection_service_spec.rb'
|
||||
|
|
|
@ -44,7 +44,7 @@ class ActivityPub::FetchRemoteStatusService < BaseService
|
|||
|
||||
# If we fetched a status that already exists, then we need to treat the
|
||||
# activity as an update rather than create
|
||||
activity_json['type'] = 'Update' if equals_or_includes_any?(activity_json['type'], %w(Create)) && Status.where(uri: object_uri, account_id: actor.id).exists?
|
||||
activity_json['type'] = 'Update' if equals_or_includes_any?(activity_json['type'], %w(Create)) && Status.exists?(uri: object_uri, account_id: actor.id)
|
||||
|
||||
with_redis do |redis|
|
||||
discoveries = redis.incr("status_discovery_per_request:#{@request_id}")
|
||||
|
|
|
@ -19,7 +19,7 @@ class VoteService < BaseService
|
|||
already_voted = true
|
||||
|
||||
with_redis_lock("vote:#{@poll.id}:#{@account.id}") do
|
||||
already_voted = @poll.votes.where(account: @account).exists?
|
||||
already_voted = @poll.votes.exists?(account: @account)
|
||||
|
||||
ApplicationRecord.transaction do
|
||||
@choices.each do |choice|
|
||||
|
|
Loading…
Reference in a new issue