forked from treehouse/mastodon
Merge pull request #1668 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changessignup-info-prompt
commit
2ba6267f16
16
Gemfile
16
Gemfile
|
@ -13,7 +13,7 @@ gem 'thor', '~> 1.2'
|
|||
gem 'rack', '~> 2.2.3'
|
||||
|
||||
gem 'hamlit-rails', '~> 0.2'
|
||||
gem 'pg', '~> 1.2'
|
||||
gem 'pg', '~> 1.3'
|
||||
gem 'makara', '~> 0.5'
|
||||
gem 'pghero', '~> 2.8'
|
||||
gem 'dotenv-rails', '~> 2.7'
|
||||
|
@ -26,12 +26,12 @@ gem 'blurhash', '~> 0.1'
|
|||
|
||||
gem 'active_model_serializers', '~> 0.10'
|
||||
gem 'addressable', '~> 2.8'
|
||||
gem 'bootsnap', '~> 1.10.1', require: false
|
||||
gem 'bootsnap', '~> 1.10.2', require: false
|
||||
gem 'browser'
|
||||
gem 'charlock_holmes', '~> 0.7.7'
|
||||
gem 'iso-639'
|
||||
gem 'chewy', '~> 7.2'
|
||||
gem 'cld3', '~> 3.4.3'
|
||||
gem 'cld3', '~> 3.4.4'
|
||||
gem 'devise', '~> 4.8'
|
||||
gem 'devise-two-factor', '~> 4.0'
|
||||
|
||||
|
@ -79,7 +79,7 @@ gem 'rqrcode', '~> 2.1'
|
|||
gem 'ruby-progressbar', '~> 1.11'
|
||||
gem 'sanitize', '~> 6.0'
|
||||
gem 'scenic', '~> 1.5'
|
||||
gem 'sidekiq', '~> 6.3'
|
||||
gem 'sidekiq', '~> 6.4'
|
||||
gem 'sidekiq-scheduler', '~> 3.1'
|
||||
gem 'sidekiq-unique-jobs', '~> 7.1'
|
||||
gem 'sidekiq-bulk', '~>0.2.0'
|
||||
|
@ -96,13 +96,13 @@ gem 'webpush', '~> 0.3'
|
|||
gem 'webauthn', '~> 3.0.0.alpha1'
|
||||
|
||||
gem 'json-ld'
|
||||
gem 'json-ld-preloaded', '~> 3.1'
|
||||
gem 'rdf-normalize', '~> 0.4'
|
||||
gem 'json-ld-preloaded', '~> 3.2'
|
||||
gem 'rdf-normalize', '~> 0.5'
|
||||
|
||||
gem 'redcarpet', '~> 3.5'
|
||||
|
||||
group :development, :test do
|
||||
gem 'fabrication', '~> 2.23'
|
||||
gem 'fabrication', '~> 2.24'
|
||||
gem 'fuubar', '~> 2.5'
|
||||
gem 'i18n-tasks', '~> 0.9', require: false
|
||||
gem 'pry-byebug', '~> 3.9'
|
||||
|
@ -135,7 +135,7 @@ group :development do
|
|||
gem 'letter_opener', '~> 1.7'
|
||||
gem 'letter_opener_web', '~> 2.0'
|
||||
gem 'memory_profiler'
|
||||
gem 'rubocop', '~> 1.24', require: false
|
||||
gem 'rubocop', '~> 1.25', require: false
|
||||
gem 'rubocop-rails', '~> 2.13', require: false
|
||||
gem 'brakeman', '~> 5.2', require: false
|
||||
gem 'bundler-audit', '~> 0.9', require: false
|
||||
|
|
158
Gemfile.lock
158
Gemfile.lock
|
@ -1,40 +1,40 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.1.4.1)
|
||||
actionpack (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
actioncable (6.1.4.4)
|
||||
actionpack (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.1.4.1)
|
||||
actionpack (= 6.1.4.1)
|
||||
activejob (= 6.1.4.1)
|
||||
activerecord (= 6.1.4.1)
|
||||
activestorage (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
actionmailbox (6.1.4.4)
|
||||
actionpack (= 6.1.4.4)
|
||||
activejob (= 6.1.4.4)
|
||||
activerecord (= 6.1.4.4)
|
||||
activestorage (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.1.4.1)
|
||||
actionpack (= 6.1.4.1)
|
||||
actionview (= 6.1.4.1)
|
||||
activejob (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
actionmailer (6.1.4.4)
|
||||
actionpack (= 6.1.4.4)
|
||||
actionview (= 6.1.4.4)
|
||||
activejob (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.1.4.1)
|
||||
actionview (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
actionpack (6.1.4.4)
|
||||
actionview (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
rack (~> 2.0, >= 2.0.9)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.1.4.1)
|
||||
actionpack (= 6.1.4.1)
|
||||
activerecord (= 6.1.4.1)
|
||||
activestorage (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
actiontext (6.1.4.4)
|
||||
actionpack (= 6.1.4.4)
|
||||
activerecord (= 6.1.4.4)
|
||||
activestorage (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
actionview (6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
|
@ -45,22 +45,22 @@ GEM
|
|||
case_transform (>= 0.2)
|
||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
||||
active_record_query_trace (1.8)
|
||||
activejob (6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
activejob (6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
activerecord (6.1.4.1)
|
||||
activemodel (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
activestorage (6.1.4.1)
|
||||
actionpack (= 6.1.4.1)
|
||||
activejob (= 6.1.4.1)
|
||||
activerecord (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
activemodel (6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
activerecord (6.1.4.4)
|
||||
activemodel (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
activestorage (6.1.4.4)
|
||||
actionpack (= 6.1.4.4)
|
||||
activejob (= 6.1.4.4)
|
||||
activerecord (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
marcel (~> 1.0.0)
|
||||
mini_mime (>= 1.1.0)
|
||||
activesupport (6.1.4.1)
|
||||
activesupport (6.1.4.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
|
@ -79,8 +79,8 @@ GEM
|
|||
encryptor (~> 3.0.0)
|
||||
awrence (1.1.1)
|
||||
aws-eventstream (1.2.0)
|
||||
aws-partitions (1.547.0)
|
||||
aws-sdk-core (3.125.1)
|
||||
aws-partitions (1.549.0)
|
||||
aws-sdk-core (3.125.5)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.525.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
|
@ -88,7 +88,7 @@ GEM
|
|||
aws-sdk-kms (1.53.0)
|
||||
aws-sdk-core (~> 3, >= 3.125.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-s3 (1.111.1)
|
||||
aws-sdk-s3 (1.111.3)
|
||||
aws-sdk-core (~> 3, >= 3.125.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.4)
|
||||
|
@ -104,7 +104,7 @@ GEM
|
|||
debug_inspector (>= 0.0.1)
|
||||
blurhash (0.1.5)
|
||||
ffi (~> 1.14)
|
||||
bootsnap (1.10.1)
|
||||
bootsnap (1.10.2)
|
||||
msgpack (~> 1.2)
|
||||
brakeman (5.2.0)
|
||||
browser (4.2.0)
|
||||
|
@ -152,7 +152,7 @@ GEM
|
|||
elasticsearch (>= 7.12.0, < 7.14.0)
|
||||
elasticsearch-dsl
|
||||
chunky_png (1.4.0)
|
||||
cld3 (3.4.3)
|
||||
cld3 (3.4.4)
|
||||
ffi (>= 1.1.0, < 1.16.0)
|
||||
climate_control (0.2.0)
|
||||
coderay (1.1.3)
|
||||
|
@ -211,7 +211,7 @@ GEM
|
|||
et-orbi (1.2.4)
|
||||
tzinfo
|
||||
excon (0.76.0)
|
||||
fabrication (2.23.1)
|
||||
fabrication (2.24.0)
|
||||
faker (2.19.0)
|
||||
i18n (>= 1.6, < 2)
|
||||
faraday (1.8.0)
|
||||
|
@ -235,7 +235,7 @@ GEM
|
|||
faraday-rack (1.0.0)
|
||||
fast_blank (1.0.1)
|
||||
fastimage (2.2.6)
|
||||
ffi (1.15.4)
|
||||
ffi (1.15.5)
|
||||
ffi-compiler (1.0.1)
|
||||
ffi (>= 1.0.0)
|
||||
rake
|
||||
|
@ -258,7 +258,7 @@ GEM
|
|||
fuubar (2.5.1)
|
||||
rspec-core (~> 3.0)
|
||||
ruby-progressbar (~> 1.4)
|
||||
globalid (0.5.2)
|
||||
globalid (1.0.0)
|
||||
activesupport (>= 5.0)
|
||||
hamlit (2.13.0)
|
||||
temple (>= 0.8.2)
|
||||
|
@ -314,9 +314,9 @@ GEM
|
|||
multi_json (~> 1.15)
|
||||
rack (~> 2.2)
|
||||
rdf (~> 3.2)
|
||||
json-ld-preloaded (3.1.6)
|
||||
json-ld (~> 3.1)
|
||||
rdf (~> 3.1)
|
||||
json-ld-preloaded (3.2.0)
|
||||
json-ld (~> 3.2)
|
||||
rdf (~> 3.2)
|
||||
jsonapi-renderer (0.2.2)
|
||||
jwt (2.2.2)
|
||||
kaminari (1.2.2)
|
||||
|
@ -377,7 +377,7 @@ GEM
|
|||
mini_mime (1.1.2)
|
||||
mini_portile2 (2.7.1)
|
||||
minitest (5.15.0)
|
||||
msgpack (1.4.2)
|
||||
msgpack (1.4.4)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.1.1)
|
||||
net-ldap (0.17.0)
|
||||
|
@ -417,7 +417,7 @@ GEM
|
|||
parslet (2.0.0)
|
||||
pastel (0.8.0)
|
||||
tty-color (~> 0.5)
|
||||
pg (1.2.3)
|
||||
pg (1.3.0)
|
||||
pghero (2.8.2)
|
||||
activerecord (>= 5)
|
||||
pkg-config (1.4.7)
|
||||
|
@ -454,20 +454,20 @@ GEM
|
|||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.1.4.1)
|
||||
actioncable (= 6.1.4.1)
|
||||
actionmailbox (= 6.1.4.1)
|
||||
actionmailer (= 6.1.4.1)
|
||||
actionpack (= 6.1.4.1)
|
||||
actiontext (= 6.1.4.1)
|
||||
actionview (= 6.1.4.1)
|
||||
activejob (= 6.1.4.1)
|
||||
activemodel (= 6.1.4.1)
|
||||
activerecord (= 6.1.4.1)
|
||||
activestorage (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
rails (6.1.4.4)
|
||||
actioncable (= 6.1.4.4)
|
||||
actionmailbox (= 6.1.4.4)
|
||||
actionmailer (= 6.1.4.4)
|
||||
actionpack (= 6.1.4.4)
|
||||
actiontext (= 6.1.4.4)
|
||||
actionview (= 6.1.4.4)
|
||||
activejob (= 6.1.4.4)
|
||||
activemodel (= 6.1.4.4)
|
||||
activerecord (= 6.1.4.4)
|
||||
activestorage (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 6.1.4.1)
|
||||
railties (= 6.1.4.4)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
|
@ -483,9 +483,9 @@ GEM
|
|||
railties (>= 6.0.0, < 7)
|
||||
rails-settings-cached (0.6.6)
|
||||
rails (>= 4.2.0)
|
||||
railties (6.1.4.1)
|
||||
actionpack (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
railties (6.1.4.4)
|
||||
actionpack (= 6.1.4.4)
|
||||
activesupport (= 6.1.4.4)
|
||||
method_source
|
||||
rake (>= 0.13)
|
||||
thor (~> 1.0)
|
||||
|
@ -493,8 +493,8 @@ GEM
|
|||
rake (13.0.6)
|
||||
rdf (3.2.3)
|
||||
link_header (~> 0.0, >= 0.0.8)
|
||||
rdf-normalize (0.4.0)
|
||||
rdf (~> 3.1)
|
||||
rdf-normalize (0.5.0)
|
||||
rdf (~> 3.2)
|
||||
redcarpet (3.5.1)
|
||||
redis (4.5.1)
|
||||
redis-namespace (1.8.1)
|
||||
|
@ -534,9 +534,9 @@ GEM
|
|||
rspec-support (3.10.3)
|
||||
rspec_junit_formatter (0.5.1)
|
||||
rspec-core (>= 2, < 4, != 2.12.0)
|
||||
rubocop (1.24.1)
|
||||
rubocop (1.25.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.0.0.0)
|
||||
parser (>= 3.1.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml
|
||||
|
@ -566,7 +566,7 @@ GEM
|
|||
railties (>= 4.0.0)
|
||||
securecompare (1.0.0)
|
||||
semantic_range (3.0.0)
|
||||
sidekiq (6.3.1)
|
||||
sidekiq (6.4.0)
|
||||
connection_pool (>= 2.2.2)
|
||||
rack (~> 2.0)
|
||||
redis (>= 4.2.0)
|
||||
|
@ -689,7 +689,7 @@ DEPENDENCIES
|
|||
better_errors (~> 2.9)
|
||||
binding_of_caller (~> 1.0)
|
||||
blurhash (~> 0.1)
|
||||
bootsnap (~> 1.10.1)
|
||||
bootsnap (~> 1.10.2)
|
||||
brakeman (~> 5.2)
|
||||
browser
|
||||
bullet (~> 7.0)
|
||||
|
@ -701,7 +701,7 @@ DEPENDENCIES
|
|||
capybara (~> 3.36)
|
||||
charlock_holmes (~> 0.7.7)
|
||||
chewy (~> 7.2)
|
||||
cld3 (~> 3.4.3)
|
||||
cld3 (~> 3.4.4)
|
||||
climate_control (~> 0.2)
|
||||
color_diff (~> 0.1)
|
||||
concurrent-ruby
|
||||
|
@ -713,7 +713,7 @@ DEPENDENCIES
|
|||
doorkeeper (~> 5.5)
|
||||
dotenv-rails (~> 2.7)
|
||||
ed25519 (~> 1.3)
|
||||
fabrication (~> 2.23)
|
||||
fabrication (~> 2.24)
|
||||
faker (~> 2.19)
|
||||
fast_blank (~> 1.0)
|
||||
fastimage
|
||||
|
@ -731,7 +731,7 @@ DEPENDENCIES
|
|||
idn-ruby
|
||||
iso-639
|
||||
json-ld
|
||||
json-ld-preloaded (~> 3.1)
|
||||
json-ld-preloaded (~> 3.2)
|
||||
kaminari (~> 1.2)
|
||||
kt-paperclip (~> 7.0)
|
||||
letter_opener (~> 1.7)
|
||||
|
@ -753,7 +753,7 @@ DEPENDENCIES
|
|||
omniauth-saml (~> 1.10)
|
||||
ox (~> 2.14)
|
||||
parslet
|
||||
pg (~> 1.2)
|
||||
pg (~> 1.3)
|
||||
pghero (~> 2.8)
|
||||
pkg-config (~> 1.4)
|
||||
posix-spawn
|
||||
|
@ -770,7 +770,7 @@ DEPENDENCIES
|
|||
rails-controller-testing (~> 1.0)
|
||||
rails-i18n (~> 6.0)
|
||||
rails-settings-cached (~> 0.6)
|
||||
rdf-normalize (~> 0.4)
|
||||
rdf-normalize (~> 0.5)
|
||||
redcarpet (~> 3.5)
|
||||
redis (~> 4.5)
|
||||
redis-namespace (~> 1.8)
|
||||
|
@ -779,12 +779,12 @@ DEPENDENCIES
|
|||
rspec-rails (~> 5.0)
|
||||
rspec-sidekiq (~> 3.1)
|
||||
rspec_junit_formatter (~> 0.5)
|
||||
rubocop (~> 1.24)
|
||||
rubocop (~> 1.25)
|
||||
rubocop-rails (~> 2.13)
|
||||
ruby-progressbar (~> 1.11)
|
||||
sanitize (~> 6.0)
|
||||
scenic (~> 1.5)
|
||||
sidekiq (~> 6.3)
|
||||
sidekiq (~> 6.4)
|
||||
sidekiq-bulk (~> 0.2.0)
|
||||
sidekiq-scheduler (~> 3.1)
|
||||
sidekiq-unique-jobs (~> 7.1)
|
||||
|
|
|
@ -57,7 +57,7 @@ class Api::V1::StatusesController < Api::BaseController
|
|||
authorize @status, :destroy?
|
||||
|
||||
@status.discard
|
||||
RemovalWorker.perform_async(@status.id, redraft: true)
|
||||
RemovalWorker.perform_async(@status.id, { 'redraft' => true })
|
||||
@status.account.statuses_count = @status.account.statuses_count - 1
|
||||
|
||||
render json: @status, serializer: REST::StatusSerializer, source_requested: true
|
||||
|
|
|
@ -64,6 +64,8 @@ module ApplicationHelper
|
|||
def link_to_login(name = nil, html_options = nil, &block)
|
||||
target = new_user_session_path
|
||||
|
||||
html_options = name if block_given?
|
||||
|
||||
if omniauth_only? && Devise.mappings[:user].omniauthable? && User.omniauth_providers.size == 1
|
||||
target = omniauth_authorize_path(:user, User.omniauth_providers[0])
|
||||
html_options ||= {}
|
||||
|
|
|
@ -94,7 +94,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
LinkCrawlWorker.perform_in(rand(1..59).seconds, @status.id)
|
||||
|
||||
# Distribute into home and list feeds and notify mentioned accounts
|
||||
::DistributionWorker.perform_async(@status.id, silenced_account_ids: @silenced_account_ids) if @options[:override_timestamps] || @status.within_realtime_window?
|
||||
::DistributionWorker.perform_async(@status.id, { 'silenced_account_ids' => @silenced_account_ids }) if @options[:override_timestamps] || @status.within_realtime_window?
|
||||
end
|
||||
|
||||
def find_existing_status
|
||||
|
@ -168,7 +168,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
|
||||
return unless delivered_to_account.following?(@account)
|
||||
|
||||
FeedInsertWorker.perform_async(@status.id, delivered_to_account.id, :home)
|
||||
FeedInsertWorker.perform_async(@status.id, delivered_to_account.id, 'home')
|
||||
end
|
||||
|
||||
def delivered_to_account
|
||||
|
|
|
@ -61,7 +61,7 @@ class FeedManager
|
|||
return false unless add_to_feed(:home, account.id, status, account.user&.aggregates_reblogs?)
|
||||
|
||||
trim(:home, account.id)
|
||||
PushUpdateWorker.perform_async(account.id, status.id, "timeline:#{account.id}", update: update) if push_update_required?("timeline:#{account.id}")
|
||||
PushUpdateWorker.perform_async(account.id, status.id, "timeline:#{account.id}", { 'update' => update }) if push_update_required?("timeline:#{account.id}")
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -86,7 +86,7 @@ class FeedManager
|
|||
return false if filter_from_list?(status, list) || !add_to_feed(:list, list.id, status, list.account.user&.aggregates_reblogs?)
|
||||
|
||||
trim(:list, list.id)
|
||||
PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}", update: update) if push_update_required?("timeline:list:#{list.id}")
|
||||
PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}", { 'update' => update }) if push_update_required?("timeline:list:#{list.id}")
|
||||
true
|
||||
end
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class Admin::StatusBatchAction
|
|||
end
|
||||
|
||||
UserMailer.warning(target_account.user, @warning).deliver_later! if target_account.local?
|
||||
RemovalWorker.push_bulk(status_ids) { |status_id| [status_id, preserve: target_account.local?, immediate: !target_account.local?] }
|
||||
RemovalWorker.push_bulk(status_ids) { |status_id| [status_id, { 'preserve' => target_account.local?, 'immediate' => !target_account.local? }] }
|
||||
end
|
||||
|
||||
def handle_report!
|
||||
|
|
|
@ -103,7 +103,7 @@ class Form::AccountBatch
|
|||
authorize(account.user, :reject?)
|
||||
log_action(:reject, account.user, username: account.username)
|
||||
account.suspend!(origin: :local)
|
||||
AccountDeletionWorker.perform_async(account.id, reserve_username: false)
|
||||
AccountDeletionWorker.perform_async(account.id, { 'reserve_username' => false })
|
||||
end
|
||||
|
||||
def suspend_account(account)
|
||||
|
|
|
@ -15,7 +15,7 @@ class AccountStatusesCleanupService < BaseService
|
|||
|
||||
account_policy.statuses_to_delete(budget, cutoff_id, account_policy.last_inspected).reorder(nil).find_each(order: :asc) do |status|
|
||||
status.discard
|
||||
RemovalWorker.perform_async(status.id, redraft: false)
|
||||
RemovalWorker.perform_async(status.id, { 'redraft' => false })
|
||||
num_deleted += 1
|
||||
last_deleted = status.id
|
||||
end
|
||||
|
|
|
@ -10,6 +10,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
@status = status
|
||||
@account = status.account
|
||||
@media_attachments_changed = false
|
||||
@poll_changed = false
|
||||
|
||||
# Only native types can be updated at the moment
|
||||
return if !expected_type? || already_updated_more_recently?
|
||||
|
@ -27,6 +28,9 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
end
|
||||
|
||||
queue_poll_notifications!
|
||||
|
||||
next unless significant_changes?
|
||||
|
||||
reset_preview_card!
|
||||
broadcast_updates!
|
||||
else
|
||||
|
@ -92,7 +96,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
# If for some reasons the options were changed, it invalidates all previous
|
||||
# votes, so we need to remove them
|
||||
if poll_parser.significantly_changes?(poll)
|
||||
@media_attachments_changed = true
|
||||
@poll_changed = true
|
||||
poll.votes.delete_all unless poll.new_record?
|
||||
end
|
||||
|
||||
|
@ -107,7 +111,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
@status.poll_id = poll.id
|
||||
elsif previous_poll.present?
|
||||
previous_poll.destroy!
|
||||
@media_attachments_changed = true
|
||||
@poll_changed = true
|
||||
@status.poll_id = nil
|
||||
end
|
||||
end
|
||||
|
@ -117,7 +121,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
@status.spoiler_text = @status_parser.spoiler_text || ''
|
||||
@status.sensitive = @account.sensitized? || @status_parser.sensitive || false
|
||||
@status.language = @status_parser.language || detected_language
|
||||
@status.edited_at = @status_parser.edited_at || Time.now.utc
|
||||
@status.edited_at = @status_parser.edited_at || Time.now.utc if significant_changes?
|
||||
|
||||
@status.save!
|
||||
end
|
||||
|
@ -227,12 +231,12 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
end
|
||||
|
||||
def create_edit!
|
||||
return unless @status.text_previously_changed? || @status.spoiler_text_previously_changed? || @media_attachments_changed
|
||||
return unless significant_changes?
|
||||
|
||||
@status_edit = @status.edits.create(
|
||||
text: @status.text,
|
||||
spoiler_text: @status.spoiler_text,
|
||||
media_attachments_changed: @media_attachments_changed,
|
||||
media_attachments_changed: @media_attachments_changed || @poll_changed,
|
||||
account_id: @account.id,
|
||||
created_at: @status.edited_at
|
||||
)
|
||||
|
@ -248,17 +252,21 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
mime_type.present? && !MediaAttachment.supported_mime_types.include?(mime_type)
|
||||
end
|
||||
|
||||
def significant_changes?
|
||||
@status.text_changed? || @status.text_previously_changed? || @status.spoiler_text_changed? || @status.spoiler_text_previously_changed? || @media_attachments_changed || @poll_changed
|
||||
end
|
||||
|
||||
def already_updated_more_recently?
|
||||
@status.edited_at.present? && @status_parser.edited_at.present? && @status.edited_at > @status_parser.edited_at
|
||||
end
|
||||
|
||||
def reset_preview_card!
|
||||
@status.preview_cards.clear if @status.text_previously_changed? || @status.spoiler_text.present?
|
||||
LinkCrawlWorker.perform_in(rand(1..59).seconds, @status.id) if @status.spoiler_text.blank?
|
||||
@status.preview_cards.clear
|
||||
LinkCrawlWorker.perform_in(rand(1..59).seconds, @status.id)
|
||||
end
|
||||
|
||||
def broadcast_updates!
|
||||
::DistributionWorker.perform_async(@status.id, update: true)
|
||||
::DistributionWorker.perform_async(@status.id, { 'update' => true })
|
||||
end
|
||||
|
||||
def queue_poll_notifications!
|
||||
|
|
|
@ -61,7 +61,7 @@ class FanOutOnWriteService < BaseService
|
|||
def notify_mentioned_accounts!
|
||||
@status.active_mentions.where.not(id: @options[:silenced_account_ids] || []).joins(:account).merge(Account.local).select(:id, :account_id).reorder(nil).find_in_batches do |mentions|
|
||||
LocalNotificationWorker.push_bulk(mentions) do |mention|
|
||||
[mention.account_id, mention.id, 'Mention', :mention]
|
||||
[mention.account_id, mention.id, 'Mention', 'mention']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ class FanOutOnWriteService < BaseService
|
|||
def deliver_to_all_followers!
|
||||
@account.followers_for_local_distribution.select(:id).reorder(nil).find_in_batches do |followers|
|
||||
FeedInsertWorker.push_bulk(followers) do |follower|
|
||||
[@status.id, follower.id, :home, update: update?]
|
||||
[@status.id, follower.id, 'home', { 'update' => update? }]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -77,7 +77,7 @@ class FanOutOnWriteService < BaseService
|
|||
def deliver_to_lists!
|
||||
@account.lists_for_local_distribution.select(:id).reorder(nil).find_in_batches do |lists|
|
||||
FeedInsertWorker.push_bulk(lists) do |list|
|
||||
[@status.id, list.id, :list, update: update?]
|
||||
[@status.id, list.id, 'list', { 'update' => update? }]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -85,14 +85,14 @@ class FanOutOnWriteService < BaseService
|
|||
def deliver_to_mentioned_followers!
|
||||
@status.mentions.joins(:account).merge(@account.followers_for_local_distribution).select(:id, :account_id).reorder(nil).find_in_batches do |mentions|
|
||||
FeedInsertWorker.push_bulk(mentions) do |mention|
|
||||
[@status.id, mention.account_id, :home, update: update?]
|
||||
[@status.id, mention.account_id, 'home', { 'update' => update? }]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def deliver_to_direct_timelines!
|
||||
FeedInsertWorker.push_bulk(@status.mentions.includes(:account).map(&:account).select { |mentioned_account| mentioned_account.local? }) do |account|
|
||||
[@status.id, account.id, :direct, update: update?]
|
||||
[@status.id, account.id, 'direct', { 'update' => update? }]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -127,7 +127,7 @@ class FanOutOnWriteService < BaseService
|
|||
end
|
||||
|
||||
def update?
|
||||
@is_update
|
||||
@options[:update]
|
||||
end
|
||||
|
||||
def broadcastable?
|
||||
|
|
|
@ -68,7 +68,7 @@ class FollowService < BaseService
|
|||
follow_request = @source_account.request_follow!(@target_account, reblogs: @options[:reblogs], notify: @options[:notify], rate_limit: @options[:with_rate_limit], bypass_limit: @options[:bypass_limit])
|
||||
|
||||
if @target_account.local?
|
||||
LocalNotificationWorker.perform_async(@target_account.id, follow_request.id, follow_request.class.name, :follow_request)
|
||||
LocalNotificationWorker.perform_async(@target_account.id, follow_request.id, follow_request.class.name, 'follow_request')
|
||||
elsif @target_account.activitypub?
|
||||
ActivityPub::DeliveryWorker.perform_async(build_json(follow_request), @source_account.id, @target_account.inbox_url)
|
||||
end
|
||||
|
@ -79,7 +79,7 @@ class FollowService < BaseService
|
|||
def direct_follow!
|
||||
follow = @source_account.follow!(@target_account, reblogs: @options[:reblogs], notify: @options[:notify], rate_limit: @options[:with_rate_limit], bypass_limit: @options[:bypass_limit])
|
||||
|
||||
LocalNotificationWorker.perform_async(@target_account.id, follow.id, follow.class.name, :follow)
|
||||
LocalNotificationWorker.perform_async(@target_account.id, follow.id, follow.class.name, 'follow')
|
||||
MergeWorker.perform_async(@target_account.id, @source_account.id)
|
||||
|
||||
follow
|
||||
|
|
|
@ -76,7 +76,7 @@ class ImportService < BaseService
|
|||
if presence_hash[target_account.acct]
|
||||
items.delete(target_account.acct)
|
||||
extra = presence_hash[target_account.acct][1]
|
||||
Import::RelationshipWorker.perform_async(@account.id, target_account.acct, action, extra)
|
||||
Import::RelationshipWorker.perform_async(@account.id, target_account.acct, action, extra.stringify_keys)
|
||||
else
|
||||
Import::RelationshipWorker.perform_async(@account.id, target_account.acct, undo_action)
|
||||
end
|
||||
|
@ -87,7 +87,7 @@ class ImportService < BaseService
|
|||
tail_items = items - head_items
|
||||
|
||||
Import::RelationshipWorker.push_bulk(head_items + tail_items) do |acct, extra|
|
||||
[@account.id, acct, action, extra]
|
||||
[@account.id, acct, action, extra.stringify_keys]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class ReblogService < BaseService
|
|||
reblogged_status = reblog.reblog
|
||||
|
||||
if reblogged_status.account.local?
|
||||
LocalNotificationWorker.perform_async(reblogged_status.account_id, reblog.id, reblog.class.name, :reblog)
|
||||
LocalNotificationWorker.perform_async(reblogged_status.account_id, reblog.id, reblog.class.name, 'reblog')
|
||||
elsif reblogged_status.account.activitypub? && !reblogged_status.account.following?(reblog.account)
|
||||
ActivityPub::DeliveryWorker.perform_async(build_json(reblog), reblog.account_id, reblogged_status.account.inbox_url)
|
||||
end
|
||||
|
|
|
@ -143,7 +143,7 @@ class ResolveAccountService < BaseService
|
|||
|
||||
def queue_deletion!
|
||||
@account.suspend!(origin: :remote)
|
||||
AccountDeletionWorker.perform_async(@account.id, reserve_username: false, skip_activitypub: true)
|
||||
AccountDeletionWorker.perform_async(@account.id, { 'reserve_username' => false, 'skip_activitypub' => true })
|
||||
end
|
||||
|
||||
def lock_options
|
||||
|
|
|
@ -27,6 +27,6 @@ class ActivityPub::DistributionWorker < ActivityPub::RawDistributionWorker
|
|||
end
|
||||
|
||||
def options
|
||||
{ synchronize_followers: @status.private_visibility? }
|
||||
{ 'synchronize_followers' => @status.private_visibility? }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class FeedInsertWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(status_id, id, type = :home, options = {})
|
||||
def perform(status_id, id, type = 'home', options = {})
|
||||
@type = type.to_sym
|
||||
@status = Status.find(status_id)
|
||||
@options = options.symbolize_keys
|
||||
|
|
|
@ -29,7 +29,7 @@ class Scheduler::UserCleanupScheduler
|
|||
def clean_discarded_statuses!
|
||||
Status.discarded.where('deleted_at <= ?', 30.days.ago).find_in_batches do |statuses|
|
||||
RemovalWorker.push_bulk(statuses) do |status|
|
||||
[status.id, { immediate: true }]
|
||||
[status.id, { 'immediate' => true }]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -118,10 +118,9 @@ Rails.application.configure do
|
|||
'Server' => 'Mastodon',
|
||||
'X-Frame-Options' => 'DENY',
|
||||
'X-Content-Type-Options' => 'nosniff',
|
||||
'X-XSS-Protection' => '1; mode=block',
|
||||
'X-XSS-Protection' => '0',
|
||||
'Permissions-Policy' => 'interest-cohort=()',
|
||||
'Referrer-Policy' => 'same-origin',
|
||||
'Strict-Transport-Security' => 'max-age=63072000; includeSubDomains; preload',
|
||||
'X-Clacks-Overhead' => 'GNU Natalie Nguyen'
|
||||
}
|
||||
|
||||
|
|
|
@ -70,3 +70,6 @@ if ENV['PAM_ENABLED'] == 'true'
|
|||
env: { email: 'pam@example.com' }
|
||||
}
|
||||
end
|
||||
|
||||
# Catch serialization warnings early
|
||||
Sidekiq.strict_args!
|
||||
|
|
|
@ -17,6 +17,21 @@ class FixAccountsUniqueIndex < ActiveRecord::Migration[5.2]
|
|||
belongs_to :account, inverse_of: :stream_entries
|
||||
end
|
||||
|
||||
class Status < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account
|
||||
end
|
||||
|
||||
class Mention < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account
|
||||
end
|
||||
|
||||
class StatusPin < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account
|
||||
end
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
|
|
|
@ -94,6 +94,9 @@ services:
|
|||
- internal_network
|
||||
volumes:
|
||||
- ./public/system:/mastodon/public/system
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "ps aux | grep '[s]idekiq\ 6' || false"]
|
||||
|
||||
## Uncomment to enable federation with tor instances along with adding the following ENV variables
|
||||
## http_proxy=http://privoxy:8118
|
||||
## ALLOW_ACCESS_TO_HIDDEN_SERVICE=true
|
||||
|
|
10
package.json
10
package.json
|
@ -61,11 +61,11 @@
|
|||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.16.7",
|
||||
"@babel/core": "^7.16.12",
|
||||
"@babel/plugin-proposal-decorators": "^7.16.7",
|
||||
"@babel/plugin-transform-react-inline-elements": "^7.16.7",
|
||||
"@babel/plugin-transform-runtime": "^7.16.8",
|
||||
"@babel/preset-env": "^7.16.8",
|
||||
"@babel/plugin-transform-runtime": "^7.16.10",
|
||||
"@babel/preset-env": "^7.16.11",
|
||||
"@babel/preset-react": "^7.16.7",
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"@gamestdio/websocket": "^0.3.2",
|
||||
|
@ -75,7 +75,7 @@
|
|||
"atrament": "0.2.4",
|
||||
"arrow-key-navigation": "^1.2.0",
|
||||
"autoprefixer": "^9.8.8",
|
||||
"axios": "^0.24.0",
|
||||
"axios": "^0.25.0",
|
||||
"babel-loader": "^8.2.3",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
"babel-plugin-preval": "^5.0.0",
|
||||
|
@ -155,7 +155,7 @@
|
|||
"requestidlecallback": "^0.3.0",
|
||||
"reselect": "^4.1.5",
|
||||
"rimraf": "^3.0.2",
|
||||
"sass": "^1.48.0",
|
||||
"sass": "^1.49.0",
|
||||
"sass-loader": "^10.2.0",
|
||||
"stacktrace-js": "^2.0.2",
|
||||
"stringz": "^2.1.0",
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe AccountsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:account) { Fabricate(:user).account }
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
shared_examples 'cachable response' do
|
||||
it 'does not set cookies' do
|
||||
|
|
|
@ -61,7 +61,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
|
|||
|
||||
describe 'GET #show' do
|
||||
let(:current_user) { Fabricate(:user, admin: true) }
|
||||
let(:account) { Fabricate(:account, username: 'bob') }
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
it 'returns http success' do
|
||||
get :show, params: { id: account.id }
|
||||
|
@ -73,7 +73,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
|
|||
subject { post :memorialize, params: { id: account.id } }
|
||||
|
||||
let(:current_user) { Fabricate(:user, admin: current_user_admin) }
|
||||
let(:account) { Fabricate(:account, user: user) }
|
||||
let(:account) { user.account }
|
||||
let(:user) { Fabricate(:user, admin: target_user_admin) }
|
||||
|
||||
context 'when user is admin' do
|
||||
|
@ -125,7 +125,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
|
|||
subject { post :enable, params: { id: account.id } }
|
||||
|
||||
let(:current_user) { Fabricate(:user, admin: admin) }
|
||||
let(:account) { Fabricate(:account, user: user) }
|
||||
let(:account) { user.account }
|
||||
let(:user) { Fabricate(:user, disabled: true) }
|
||||
|
||||
context 'when user is admin' do
|
||||
|
|
|
@ -11,10 +11,9 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
|
|||
|
||||
describe "GET #show" do
|
||||
it "returns http success" do
|
||||
account = Fabricate(:account)
|
||||
user = Fabricate(:user, account: account)
|
||||
user = Fabricate(:user)
|
||||
|
||||
get :show, params: { account_id: account.id }
|
||||
get :show, params: { account_id: user.account.id }
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
@ -26,12 +25,11 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
|
|||
end
|
||||
|
||||
it "returns http success" do
|
||||
account = Fabricate(:account)
|
||||
user = Fabricate(:user, account: account)
|
||||
user = Fabricate(:user)
|
||||
|
||||
previous_email = user.email
|
||||
|
||||
post :update, params: { account_id: account.id, user: { unconfirmed_email: 'test@example.com' } }
|
||||
post :update, params: { account_id: user.account.id, user: { unconfirmed_email: 'test@example.com' } }
|
||||
|
||||
user.reload
|
||||
|
||||
|
@ -41,7 +39,7 @@ RSpec.describe Admin::ChangeEmailsController, type: :controller do
|
|||
|
||||
expect(UserMailer).to have_received(:confirmation_instructions).with(user, user.confirmation_token, { to: 'test@example.com' })
|
||||
|
||||
expect(response).to redirect_to(admin_account_path(account.id))
|
||||
expect(response).to redirect_to(admin_account_path(user.account.id))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,9 +9,8 @@ RSpec.describe Admin::ConfirmationsController, type: :controller do
|
|||
|
||||
describe 'POST #create' do
|
||||
it 'confirms the user' do
|
||||
account = Fabricate(:account)
|
||||
user = Fabricate(:user, confirmed_at: false, account: account)
|
||||
post :create, params: { account_id: account.id }
|
||||
user = Fabricate(:user, confirmed_at: false)
|
||||
post :create, params: { account_id: user.account.id }
|
||||
|
||||
expect(response).to redirect_to(admin_accounts_path)
|
||||
expect(user.reload).to be_confirmed
|
||||
|
@ -32,10 +31,9 @@ RSpec.describe Admin::ConfirmationsController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'POST #resernd' do
|
||||
subject { post :resend, params: { account_id: account.id } }
|
||||
subject { post :resend, params: { account_id: user.account.id } }
|
||||
|
||||
let(:account) { Fabricate(:account) }
|
||||
let!(:user) { Fabricate(:user, confirmed_at: confirmed_at, account: account) }
|
||||
let!(:user) { Fabricate(:user, confirmed_at: confirmed_at) }
|
||||
|
||||
before do
|
||||
allow(UserMailer).to receive(:confirmation_instructions) { double(:email, deliver_later: nil) }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Admin::ResetsController do
|
||||
render_views
|
||||
|
||||
let(:account) { Fabricate(:account, user: Fabricate(:user)) }
|
||||
let(:account) { Fabricate(:account) }
|
||||
before do
|
||||
sign_in Fabricate(:user, admin: true), scope: :user
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ describe Api::BaseController do
|
|||
end
|
||||
|
||||
describe 'non-functional accounts handling' do
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read') }
|
||||
|
||||
controller do
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Accounts::CredentialsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
||||
context 'with an oauth token' do
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Accounts::FollowerAccountsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') }
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:alice) { Fabricate(:account) }
|
||||
|
@ -49,10 +49,10 @@ describe Api::V1::Accounts::FollowerAccountsController do
|
|||
end
|
||||
|
||||
context 'when requesting user is the account owner' do
|
||||
let(:user) { Fabricate(:user, account: account) }
|
||||
let(:user) { account.user }
|
||||
|
||||
it 'returns all accounts, including muted accounts' do
|
||||
user.account.mute!(bob)
|
||||
account.mute!(bob)
|
||||
get :index, params: { account_id: account.id, limit: 2 }
|
||||
|
||||
expect(body_as_json.size).to eq 2
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Accounts::FollowingAccountsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') }
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:alice) { Fabricate(:account) }
|
||||
|
@ -49,10 +49,10 @@ describe Api::V1::Accounts::FollowingAccountsController do
|
|||
end
|
||||
|
||||
context 'when requesting user is the account owner' do
|
||||
let(:user) { Fabricate(:user, account: account) }
|
||||
let(:user) { account.user }
|
||||
|
||||
it 'returns all accounts, including muted accounts' do
|
||||
user.account.mute!(bob)
|
||||
account.mute!(bob)
|
||||
get :index, params: { account_id: account.id, limit: 2 }
|
||||
|
||||
expect(body_as_json.size).to eq 2
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Accounts::ListsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:lists') }
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:list) { Fabricate(:list, account: user.account) }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Accounts::NotesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write:accounts') }
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:comment) { 'foo' }
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::V1::Accounts::PinsController, type: :controller do
|
||||
let(:john) { Fabricate(:user, account: Fabricate(:account, username: 'john')) }
|
||||
let(:kevin) { Fabricate(:user, account: Fabricate(:account, username: 'kevin')) }
|
||||
let(:john) { Fabricate(:user) }
|
||||
let(:kevin) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: john.id, scopes: 'write:accounts') }
|
||||
|
||||
before do
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Accounts::RelationshipsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:follows') }
|
||||
|
||||
before do
|
||||
|
@ -11,8 +11,8 @@ describe Api::V1::Accounts::RelationshipsController do
|
|||
end
|
||||
|
||||
describe 'GET #index' do
|
||||
let(:simon) { Fabricate(:user, email: 'simon@example.com', account: Fabricate(:account, username: 'simon')).account }
|
||||
let(:lewis) { Fabricate(:user, email: 'lewis@example.com', account: Fabricate(:account, username: 'lewis')).account }
|
||||
let(:simon) { Fabricate(:account) }
|
||||
let(:lewis) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
user.account.follow!(simon)
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::Accounts::SearchController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') }
|
||||
|
||||
before do
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Accounts::StatusesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:statuses') }
|
||||
|
||||
before do
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::AccountsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:scopes) { '' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
||||
|
@ -69,7 +69,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #follow' do
|
||||
let(:scopes) { 'write:follows' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', locked: locked)).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob', locked: locked) }
|
||||
|
||||
context do
|
||||
before do
|
||||
|
@ -150,7 +150,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #unfollow' do
|
||||
let(:scopes) { 'write:follows' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
user.account.follow!(other_account)
|
||||
|
@ -170,7 +170,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #remove_from_followers' do
|
||||
let(:scopes) { 'write:follows' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
other_account.follow!(user.account)
|
||||
|
@ -190,7 +190,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #block' do
|
||||
let(:scopes) { 'write:blocks' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
user.account.follow!(other_account)
|
||||
|
@ -214,7 +214,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #unblock' do
|
||||
let(:scopes) { 'write:blocks' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
user.account.block!(other_account)
|
||||
|
@ -234,7 +234,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #mute' do
|
||||
let(:scopes) { 'write:mutes' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
user.account.follow!(other_account)
|
||||
|
@ -262,7 +262,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #mute with notifications set to false' do
|
||||
let(:scopes) { 'write:mutes' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
user.account.follow!(other_account)
|
||||
|
@ -290,7 +290,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #mute with nonzero duration set' do
|
||||
let(:scopes) { 'write:mutes' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
user.account.follow!(other_account)
|
||||
|
@ -318,7 +318,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
|||
|
||||
describe 'POST #unmute' do
|
||||
let(:scopes) { 'write:mutes' }
|
||||
let(:other_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
|
||||
let(:other_account) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
user.account.mute!(other_account)
|
||||
|
|
|
@ -4,10 +4,10 @@ RSpec.describe Api::V1::Admin::AccountActionsController, type: :controller do
|
|||
render_views
|
||||
|
||||
let(:role) { 'moderator' }
|
||||
let(:user) { Fabricate(:user, role: role, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user, role: role) }
|
||||
let(:scopes) { 'admin:read admin:write' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:account) { Fabricate(:user).account }
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
|
|
|
@ -4,10 +4,10 @@ RSpec.describe Api::V1::Admin::AccountsController, type: :controller do
|
|||
render_views
|
||||
|
||||
let(:role) { 'moderator' }
|
||||
let(:user) { Fabricate(:user, role: role, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user, role: role) }
|
||||
let(:scopes) { 'admin:read admin:write' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:account) { Fabricate(:user).account }
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
|
|
|
@ -4,7 +4,7 @@ RSpec.describe Api::V1::Admin::ReportsController, type: :controller do
|
|||
render_views
|
||||
|
||||
let(:role) { 'moderator' }
|
||||
let(:user) { Fabricate(:user, role: role, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user, role: role) }
|
||||
let(:scopes) { 'admin:read admin:write' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:report) { Fabricate(:report) }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::BlocksController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:scopes) { 'read:blocks' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::ConversationsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let!(:user) { Fabricate(:user, account_attributes: { username: 'alice' }) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:other) { Fabricate(:user, account: Fabricate(:account, username: 'bob')) }
|
||||
let(:other) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::DomainBlocksController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
||||
before do
|
||||
|
|
|
@ -3,9 +3,9 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::FollowRequestsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice', locked: true)) }
|
||||
let(:user) { Fabricate(:user, account_attributes: { locked: true }) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:follower) { Fabricate(:account, username: 'bob') }
|
||||
let(:follower) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
FollowService.new.call(follower, user.account)
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::InstancesController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
|
||||
|
||||
before do
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Lists::AccountsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:list) { Fabricate(:list, account: user.account) }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::ListsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let!(:user) { Fabricate(:user) }
|
||||
let!(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let!(:list) { Fabricate(:list, account: user.account) }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::MarkersController, type: :controller do
|
||||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let!(:user) { Fabricate(:user) }
|
||||
let!(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:statuses write:statuses') }
|
||||
|
||||
before { allow(controller).to receive(:doorkeeper_token) { token } }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::MediaController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write:media') }
|
||||
|
||||
before do
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::MutesController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:scopes) { 'read:mutes' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::NotificationsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user, account_attributes: { username: 'alice' }) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:other) { Fabricate(:user, account: Fabricate(:account, username: 'bob')) }
|
||||
let(:third) { Fabricate(:user, account: Fabricate(:account, username: 'carol')) }
|
||||
let(:other) { Fabricate(:user) }
|
||||
let(:third) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::Polls::VotesController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:scopes) { 'write:statuses' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::PollsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:scopes) { 'read:statuses' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::ReportsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
|
||||
before do
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Statuses::BookmarksController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write:bookmarks', application: app) }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: app, scopes: 'read:accounts') }
|
||||
let(:alice) { Fabricate(:account) }
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Statuses::FavouritesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write:favourites', application: app) }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Statuses::HistoriesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:statuses', application: app) }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Statuses::MutesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write:mutes', application: app) }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Statuses::PinsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write:accounts', application: app) }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::Statuses::RebloggedByAccountsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: app, scopes: 'read:accounts') }
|
||||
let(:alice) { Fabricate(:account) }
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Statuses::ReblogsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write:statuses', application: app) }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Statuses::SourcesController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:statuses', application: app) }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V1::StatusesController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: app, scopes: scopes) }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Timelines::HomeController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice'), current_sign_in_at: 1.day.ago) }
|
||||
let(:user) { Fabricate(:user, current_sign_in_at: 1.day.ago) }
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Timelines::ListController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:list) { Fabricate(:list, account: user.account) }
|
||||
|
||||
before do
|
||||
|
@ -30,7 +30,7 @@ describe Api::V1::Timelines::ListController do
|
|||
end
|
||||
|
||||
context 'with the wrong user context' do
|
||||
let(:other_user) { Fabricate(:user, account: Fabricate(:account, username: 'bob')) }
|
||||
let(:other_user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: other_user.id, scopes: 'read') }
|
||||
|
||||
describe 'GET #show' do
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Timelines::PublicController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
describe Api::V1::Timelines::TagController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
RSpec.describe Api::V2::SearchController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:search') }
|
||||
|
||||
before do
|
||||
|
|
|
@ -49,7 +49,7 @@ describe ApplicationController, type: :controller do
|
|||
|
||||
it 'returns account if signed in' do
|
||||
account = Fabricate(:account)
|
||||
sign_in(Fabricate(:user, account: account))
|
||||
sign_in(account.user)
|
||||
expect(controller.view_context.current_account).to eq account
|
||||
end
|
||||
end
|
||||
|
@ -168,13 +168,13 @@ describe ApplicationController, type: :controller do
|
|||
end
|
||||
|
||||
it 'does nothing if user who signed in is not suspended' do
|
||||
sign_in(Fabricate(:user, account: Fabricate(:account, suspended: false)))
|
||||
sign_in(Fabricate(:account, suspended: false).user)
|
||||
get 'success'
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'redirects to account status page' do
|
||||
sign_in(Fabricate(:user, account: Fabricate(:account, suspended: true)))
|
||||
sign_in(Fabricate(:account, suspended: true).user)
|
||||
get 'success'
|
||||
expect(response).to redirect_to(edit_user_registration_path)
|
||||
end
|
||||
|
|
|
@ -228,7 +228,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
|
|||
end
|
||||
|
||||
it 'does nothing if user already exists' do
|
||||
Fabricate(:user, account: Fabricate(:account, username: 'test'))
|
||||
Fabricate(:account, username: 'test')
|
||||
subject
|
||||
end
|
||||
|
||||
|
|
|
@ -37,8 +37,11 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
|
||||
context 'with a suspended user' do
|
||||
before do
|
||||
user.account.suspend!
|
||||
end
|
||||
|
||||
it 'redirects to home after sign out' do
|
||||
Fabricate(:account, user: user, suspended: true)
|
||||
sign_in(user, scope: :user)
|
||||
delete :destroy
|
||||
|
||||
|
@ -78,8 +81,8 @@ RSpec.describe Auth::SessionsController, type: :controller do
|
|||
end
|
||||
|
||||
context 'using a valid email and existing user' do
|
||||
let(:user) do
|
||||
account = Fabricate.build(:account, username: 'pam_user1')
|
||||
let!(:user) do
|
||||
account = Fabricate.build(:account, username: 'pam_user1', user: nil)
|
||||
account.save!(validate: false)
|
||||
user = Fabricate(:user, email: 'pam@example.com', password: nil, account: account, external: true)
|
||||
user
|
||||
|
|
|
@ -16,7 +16,6 @@ describe AuthorizeInteractionsController do
|
|||
|
||||
describe 'when signed in' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:account) { Fabricate(:account, user: user) }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
|
@ -76,7 +75,7 @@ describe AuthorizeInteractionsController do
|
|||
|
||||
describe 'when signed in' do
|
||||
let!(:user) { Fabricate(:user) }
|
||||
let!(:account) { user.account }
|
||||
let(:account) { user.account }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
|
|
|
@ -17,7 +17,7 @@ describe ApplicationController, type: :controller do
|
|||
|
||||
context 'when account is suspended' do
|
||||
it 'returns http gone' do
|
||||
account = Fabricate(:account, suspended: true, user: Fabricate(:user))
|
||||
account = Fabricate(:account, suspended: true)
|
||||
get 'success', params: { account_username: account.username }
|
||||
expect(response).to have_http_status(410)
|
||||
end
|
||||
|
@ -33,19 +33,19 @@ describe ApplicationController, type: :controller do
|
|||
|
||||
context 'when account is not suspended' do
|
||||
it 'assigns @account' do
|
||||
account = Fabricate(:account, user: Fabricate(:user))
|
||||
account = Fabricate(:account)
|
||||
get 'success', params: { account_username: account.username }
|
||||
expect(assigns(:account)).to eq account
|
||||
end
|
||||
|
||||
it 'sets link headers' do
|
||||
account = Fabricate(:account, username: 'username', user: Fabricate(:user))
|
||||
account = Fabricate(:account, username: 'username')
|
||||
get 'success', params: { account_username: 'username' }
|
||||
expect(response.headers['Link'].to_s).to eq '<http://test.host/.well-known/webfinger?resource=acct%3Ausername%40cb6e6126.ngrok.io>; rel="lrdd"; type="application/jrd+json", <https://cb6e6126.ngrok.io/users/username>; rel="alternate"; type="application/activity+json"'
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
account = Fabricate(:account, user: Fabricate(:user))
|
||||
account = Fabricate(:account)
|
||||
get 'success', params: { account_username: account.username }
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
|
|
@ -12,14 +12,14 @@ RSpec.describe AccountableConcern do
|
|||
end
|
||||
end
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account)) }
|
||||
let(:target) { Fabricate(:user, account: Fabricate(:account)) }
|
||||
let(:hoge) { Hoge.new(user.account) }
|
||||
let(:user) { Fabricate(:account) }
|
||||
let(:target) { Fabricate(:account) }
|
||||
let(:hoge) { Hoge.new(user) }
|
||||
|
||||
describe '#log_action' do
|
||||
it 'creates Admin::ActionLog' do
|
||||
expect do
|
||||
hoge.log_action(:create, target.account)
|
||||
hoge.log_action(:create, target)
|
||||
end.to change { Admin::ActionLog.count }.by(1)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe FollowerAccountsController do
|
||||
render_views
|
||||
|
||||
let(:alice) { Fabricate(:user).account }
|
||||
let(:alice) { Fabricate(:account) }
|
||||
let(:follower0) { Fabricate(:account) }
|
||||
let(:follower1) { Fabricate(:account) }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe FollowingAccountsController do
|
||||
render_views
|
||||
|
||||
let(:alice) { Fabricate(:user).account }
|
||||
let(:alice) { Fabricate(:account) }
|
||||
let(:followee0) { Fabricate(:account) }
|
||||
let(:followee1) { Fabricate(:account) }
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ describe Settings::DeletesController do
|
|||
end
|
||||
|
||||
context 'when suspended' do
|
||||
let(:user) { Fabricate(:user, account_attributes: { username: 'alice', suspended_at: Time.now.utc }) }
|
||||
let(:user) { Fabricate(:user, account_attributes: { suspended_at: Time.now.utc }) }
|
||||
|
||||
it 'returns http forbidden' do
|
||||
get :show
|
||||
|
@ -64,7 +64,7 @@ describe Settings::DeletesController do
|
|||
end
|
||||
|
||||
context 'when suspended' do
|
||||
let(:user) { Fabricate(:user, account_attributes: { username: 'alice', suspended_at: Time.now.utc }) }
|
||||
let(:user) { Fabricate(:user, account_attributes: { suspended_at: Time.now.utc }) }
|
||||
|
||||
it 'returns http forbidden' do
|
||||
expect(response).to have_http_status(403)
|
||||
|
|
|
@ -19,8 +19,7 @@ describe Settings::MigrationsController do
|
|||
context 'when user is sign in' do
|
||||
subject { get :show }
|
||||
|
||||
let(:user) { Fabricate(:user, account: account) }
|
||||
let(:account) { Fabricate(:account, moved_to_account: moved_to_account) }
|
||||
let(:user) { Fabricate(:account, moved_to_account: moved_to_account).user }
|
||||
|
||||
before { sign_in user, scope: :user }
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@ require 'rails_helper'
|
|||
RSpec.describe Settings::ProfilesController, type: :controller do
|
||||
render_views
|
||||
|
||||
let!(:user) { Fabricate(:user) }
|
||||
let(:account) { user.account }
|
||||
|
||||
before do
|
||||
@user = Fabricate(:user)
|
||||
sign_in @user, scope: :user
|
||||
sign_in user, scope: :user
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
|
@ -16,10 +18,12 @@ RSpec.describe Settings::ProfilesController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
before do
|
||||
user.account.update(display_name: 'Old name')
|
||||
end
|
||||
|
||||
it 'updates the user profile' do
|
||||
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
|
||||
account = Fabricate(:account, user: @user, display_name: 'Old name')
|
||||
|
||||
put :update, params: { account: { display_name: 'New name' } }
|
||||
expect(account.reload.display_name).to eq 'New name'
|
||||
expect(response).to redirect_to(settings_profile_path)
|
||||
|
@ -30,7 +34,6 @@ RSpec.describe Settings::ProfilesController, type: :controller do
|
|||
describe 'PUT #update with new profile image' do
|
||||
it 'updates profile image' do
|
||||
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
|
||||
account = Fabricate(:account, user: @user, display_name: 'AvatarTest')
|
||||
expect(account.avatar.instance.avatar_file_name).to be_nil
|
||||
|
||||
put :update, params: { account: { avatar: fixture_file_upload('avatar.gif', 'image/gif') } }
|
||||
|
@ -43,7 +46,6 @@ RSpec.describe Settings::ProfilesController, type: :controller do
|
|||
describe 'PUT #update with oversized image' do
|
||||
it 'gives the user an error message' do
|
||||
allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
|
||||
account = Fabricate(:account, user: @user, display_name: 'AvatarTest')
|
||||
put :update, params: { account: { avatar: fixture_file_upload('4096x4097.png', 'image/png') } }
|
||||
expect(response.body).to include('images are not supported')
|
||||
end
|
||||
|
|
|
@ -10,4 +10,5 @@ Fabricator(:account) do
|
|||
private_key { private_key }
|
||||
suspended_at { |attrs| attrs[:suspended] ? Time.now.utc : nil }
|
||||
silenced_at { |attrs| attrs[:silenced] ? Time.now.utc : nil }
|
||||
user { |attrs| attrs[:domain].nil? ? Fabricate.build(:user, account: nil) : nil }
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Fabricator(:user) do
|
||||
account
|
||||
account { Fabricate.build(:account, user: nil) }
|
||||
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
|
||||
password "123456789"
|
||||
confirmed_at { Time.zone.now }
|
||||
|
|
|
@ -4,14 +4,13 @@ RSpec.describe ActivityPub::Activity::Update do
|
|||
let!(:sender) { Fabricate(:account) }
|
||||
|
||||
before do
|
||||
stub_request(:get, actor_json[:outbox]).to_return(status: 404)
|
||||
stub_request(:get, actor_json[:followers]).to_return(status: 404)
|
||||
stub_request(:get, actor_json[:following]).to_return(status: 404)
|
||||
stub_request(:get, actor_json[:featured]).to_return(status: 404)
|
||||
|
||||
sender.update!(uri: ActivityPub::TagManager.instance.uri_for(sender))
|
||||
end
|
||||
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
describe '#perform' do
|
||||
context 'with an Actor object' do
|
||||
let(:modified_sender) do
|
||||
sender.tap do |modified_sender|
|
||||
modified_sender.display_name = 'Totally modified now'
|
||||
|
@ -32,10 +31,12 @@ RSpec.describe ActivityPub::Activity::Update do
|
|||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
describe '#perform' do
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
before do
|
||||
stub_request(:get, actor_json[:outbox]).to_return(status: 404)
|
||||
stub_request(:get, actor_json[:followers]).to_return(status: 404)
|
||||
stub_request(:get, actor_json[:following]).to_return(status: 404)
|
||||
stub_request(:get, actor_json[:featured]).to_return(status: 404)
|
||||
|
||||
subject.perform
|
||||
end
|
||||
|
||||
|
@ -43,4 +44,57 @@ RSpec.describe ActivityPub::Activity::Update do
|
|||
expect(sender.reload.display_name).to eq 'Totally modified now'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a Question object' do
|
||||
let!(:at_time) { Time.now.utc }
|
||||
let!(:status) { Fabricate(:status, account: sender, poll: Poll.new(account: sender, options: %w(Bar Baz), cached_tallies: [0, 0], expires_at: at_time + 5.days)) }
|
||||
|
||||
let(:json) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: 'foo',
|
||||
type: 'Update',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: {
|
||||
type: 'Question',
|
||||
id: ActivityPub::TagManager.instance.uri_for(status),
|
||||
content: 'Foo',
|
||||
endTime: (at_time + 5.days).iso8601,
|
||||
oneOf: [
|
||||
{
|
||||
type: 'Note',
|
||||
name: 'Bar',
|
||||
replies: {
|
||||
type: 'Collection',
|
||||
totalItems: 0,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
type: 'Note',
|
||||
name: 'Baz',
|
||||
replies: {
|
||||
type: 'Collection',
|
||||
totalItems: 12,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
before do
|
||||
status.update!(uri: ActivityPub::TagManager.instance.uri_for(status))
|
||||
subject.perform
|
||||
end
|
||||
|
||||
it 'updates poll numbers' do
|
||||
expect(status.preloadable_poll.cached_tallies).to eq [0, 12]
|
||||
end
|
||||
|
||||
it 'does not set status as edited' do
|
||||
expect(status.edited_at).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,11 +4,15 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe AdminMailer, type: :mailer do
|
||||
describe '.new_report' do
|
||||
let(:sender) { Fabricate(:account, username: 'John', user: Fabricate(:user)) }
|
||||
let(:recipient) { Fabricate(:account, username: 'Mike', user: Fabricate(:user, locale: :en)) }
|
||||
let(:sender) { Fabricate(:account, username: 'John') }
|
||||
let(:recipient) { Fabricate(:account, username: 'Mike') }
|
||||
let(:report) { Fabricate(:report, account: sender, target_account: recipient) }
|
||||
let(:mail) { described_class.new_report(recipient, report) }
|
||||
|
||||
before do
|
||||
recipient.user.update(locale: :en)
|
||||
end
|
||||
|
||||
it 'renders the headers' do
|
||||
expect(mail.subject).to eq("New report for cb6e6126.ngrok.io (##{report.id})")
|
||||
expect(mail.to).to eq [recipient.user_email]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe NotificationMailer, type: :mailer do
|
||||
let(:receiver) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:receiver) { Fabricate(:user) }
|
||||
let(:sender) { Fabricate(:account, username: 'bob') }
|
||||
let(:foreign_status) { Fabricate(:status, account: sender, text: 'The body of the foreign status') }
|
||||
let(:own_status) { Fabricate(:status, account: receiver.account, text: 'The body of the own status') }
|
||||
|
|
|
@ -17,7 +17,7 @@ RSpec.describe Account, type: :model do
|
|||
end
|
||||
|
||||
context 'when the account is of a local user' do
|
||||
let!(:subject) { Fabricate(:account, user: Fabricate(:user, email: 'foo+bar@domain.org')) }
|
||||
let!(:subject) { Fabricate(:user, email: 'foo+bar@domain.org').account }
|
||||
|
||||
it 'creates a canonical domain block' do
|
||||
subject.suspend!
|
||||
|
|
|
@ -5,8 +5,8 @@ RSpec.describe Admin::AccountAction, type: :model do
|
|||
|
||||
describe '#save!' do
|
||||
subject { account_action.save! }
|
||||
let(:account) { Fabricate(:account, user: Fabricate(:user, admin: true)) }
|
||||
let(:target_account) { Fabricate(:account, user: Fabricate(:user)) }
|
||||
let(:account) { Fabricate(:user, admin: true).account }
|
||||
let(:target_account) { Fabricate(:account) }
|
||||
let(:type) { 'disable' }
|
||||
|
||||
before do
|
||||
|
|
|
@ -31,7 +31,6 @@ RSpec.describe PublicFeed, type: :model do
|
|||
end
|
||||
|
||||
it 'filters out silenced accounts' do
|
||||
account = Fabricate(:account)
|
||||
silenced_account = Fabricate(:account, silenced: true)
|
||||
status = Fabricate(:status, account: account)
|
||||
silenced_status = Fabricate(:status, account: silenced_account)
|
||||
|
@ -238,8 +237,7 @@ RSpec.describe PublicFeed, type: :model do
|
|||
|
||||
context 'with language preferences' do
|
||||
it 'excludes statuses in languages not allowed by the account user' do
|
||||
user = Fabricate(:user, chosen_languages: [:en, :es])
|
||||
@account.update(user: user)
|
||||
@account.user.update(chosen_languages: [:en, :es])
|
||||
en_status = Fabricate(:status, language: 'en')
|
||||
es_status = Fabricate(:status, language: 'es')
|
||||
fr_status = Fabricate(:status, language: 'fr')
|
||||
|
@ -250,8 +248,7 @@ RSpec.describe PublicFeed, type: :model do
|
|||
end
|
||||
|
||||
it 'includes all languages when user does not have a setting' do
|
||||
user = Fabricate(:user, chosen_languages: nil)
|
||||
@account.update(user: user)
|
||||
@account.user.update(chosen_languages: nil)
|
||||
|
||||
en_status = Fabricate(:status, language: 'en')
|
||||
es_status = Fabricate(:status, language: 'es')
|
||||
|
@ -261,7 +258,8 @@ RSpec.describe PublicFeed, type: :model do
|
|||
end
|
||||
|
||||
it 'includes all languages when account does not have a user' do
|
||||
expect(@account.user).to be_nil
|
||||
@account.update(user: nil)
|
||||
|
||||
en_status = Fabricate(:status, language: 'en')
|
||||
es_status = Fabricate(:status, language: 'es')
|
||||
|
||||
|
|
|
@ -194,12 +194,12 @@ RSpec.describe User, type: :model do
|
|||
end
|
||||
|
||||
it "returns 'private' if user has not configured default privacy setting and account is locked" do
|
||||
user = Fabricate(:user, account: Fabricate(:account, locked: true))
|
||||
user = Fabricate(:account, locked: true).user
|
||||
expect(user.setting_default_privacy).to eq 'private'
|
||||
end
|
||||
|
||||
it "returns 'public' if user has not configured default privacy setting and account is not locked" do
|
||||
user = Fabricate(:user, account: Fabricate(:account, locked: false))
|
||||
user = Fabricate(:account, locked: false).user
|
||||
expect(user.setting_default_privacy).to eq 'public'
|
||||
end
|
||||
end
|
||||
|
@ -248,7 +248,7 @@ RSpec.describe User, type: :model do
|
|||
|
||||
it_behaves_like 'Settings-extended' do
|
||||
def create!
|
||||
User.create!(account: Fabricate(:account), email: 'foo@mastodon.space', password: 'abcd1234', agreement: true)
|
||||
User.create!(account: Fabricate(:account, user: nil), email: 'foo@mastodon.space', password: 'abcd1234', agreement: true)
|
||||
end
|
||||
|
||||
def fabricate
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'pundit/rspec'
|
|||
RSpec.describe AccountModerationNotePolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:admin) { Fabricate(:user, admin: true).account }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
|
||||
permissions :create? do
|
||||
context 'staff' do
|
||||
|
@ -42,7 +42,7 @@ RSpec.describe AccountModerationNotePolicy do
|
|||
end
|
||||
|
||||
context 'neither admin nor owner' do
|
||||
let(:kevin) { Fabricate(:user).account }
|
||||
let(:kevin) { Fabricate(:account) }
|
||||
|
||||
it 'denies to destroy' do
|
||||
expect(subject).to_not permit(kevin, account_moderation_note)
|
||||
|
|
|
@ -6,8 +6,8 @@ require 'pundit/rspec'
|
|||
RSpec.describe AccountPolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:admin) { Fabricate(:user, admin: true).account }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:alice) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
let(:alice) { Fabricate(:account) }
|
||||
|
||||
permissions :index? do
|
||||
context 'staff' do
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'pundit/rspec'
|
|||
|
||||
RSpec.describe BackupPolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
|
||||
permissions :create? do
|
||||
context 'not user_signed_in?' do
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'pundit/rspec'
|
|||
RSpec.describe CustomEmojiPolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:admin) { Fabricate(:user, admin: true).account }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
|
||||
permissions :index?, :enable?, :disable? do
|
||||
context 'staff' do
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'pundit/rspec'
|
|||
RSpec.describe DomainBlockPolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:admin) { Fabricate(:user, admin: true).account }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
|
||||
permissions :index?, :show?, :create?, :destroy? do
|
||||
context 'admin' do
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'pundit/rspec'
|
|||
RSpec.describe EmailDomainBlockPolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:admin) { Fabricate(:user, admin: true).account }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
|
||||
permissions :index?, :create?, :destroy? do
|
||||
context 'admin' do
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'pundit/rspec'
|
|||
RSpec.describe InstancePolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:admin) { Fabricate(:user, admin: true).account }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
|
||||
permissions :index?, :show?, :destroy? do
|
||||
context 'admin' do
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'pundit/rspec'
|
|||
RSpec.describe InvitePolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:admin) { Fabricate(:user, admin: true).account }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
|
||||
permissions :index? do
|
||||
context 'staff?' do
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'pundit/rspec'
|
|||
RSpec.describe RelayPolicy do
|
||||
let(:subject) { described_class }
|
||||
let(:admin) { Fabricate(:user, admin: true).account }
|
||||
let(:john) { Fabricate(:user).account }
|
||||
let(:john) { Fabricate(:account) }
|
||||
|
||||
permissions :update? do
|
||||
context 'admin?' do
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue