Conflicts: - `README.md`: Upstream README has been changed, but we have a completely different one. Kept our `README.md`. - `lib/sanitize_ext/sanitize_config.rb`: Upstream added support for more incoming HTML tags (a large subset of what glitch-soc accepts). Change the code style to match upstream's but otherwise do not change our code. - `spec/lib/sanitize_config_spec.rb`: Upstream added support for more incoming HTML tags (a large subset of what glitch-soc accepts). Kept our version, since the tests are mostly glitch-soc's, except for cases which are purposefuly different.closed-social-glitch-2
@ -0,0 +1,8 @@ | |||
👋 Welcome to "Mastodon" in GitHub Codespaces! | |||
🛠️ Your environment is fully setup with all the required software. | |||
🔍 To explore VS Code to its fullest, search using the Command Palette (Cmd/Ctrl + Shift + P or F1). | |||
📝 Edit away, run your app as usual, and we'll automatically make it available for you to access. | |||
@ -0,0 +1,64 @@ | |||
.status__content__text, | |||
.e-content, | |||
.reply-indicator__content { | |||
pre, | |||
blockquote { | |||
margin-bottom: 20px; | |||
white-space: pre-wrap; | |||
unicode-bidi: plaintext; | |||
&:last-child { | |||
margin-bottom: 0; | |||
} | |||
} | |||
blockquote { | |||
padding-left: 10px; | |||
border-left: 3px solid $darker-text-color; | |||
color: $darker-text-color; | |||
white-space: normal; | |||
p:last-child { | |||
margin-bottom: 0; | |||
} | |||
} | |||
& > ul, | |||
& > ol { | |||
margin-bottom: 20px; | |||
} | |||
b, | |||
strong { | |||
font-weight: 700; | |||
} | |||
em, | |||
i { | |||
font-style: italic; | |||
} | |||
ul, | |||
ol { | |||
margin-left: 2em; | |||
p { | |||
margin: 0; | |||
} | |||
} | |||
ul { | |||
list-style-type: disc; | |||
} | |||
ol { | |||
list-style-type: decimal; | |||
} | |||
} | |||
.reply-indicator__content { | |||
blockquote { | |||
border-left-color: $inverted-text-color; | |||
color: $inverted-text-color; | |||
} | |||
} |
@ -0,0 +1,40 @@ | |||
# frozen_string_literal: true | |||
class FollowMigrationService < FollowService | |||
# Follow an account with the same settings as another account, and unfollow the old account once the request is sent | |||
# @param [Account] source_account From which to follow | |||
# @param [Account] target_account Account to follow | |||
# @param [Account] old_target_account Account to unfollow once the follow request has been sent to the new one | |||
# @option [Boolean] bypass_locked Whether to immediately follow the new account even if it is locked | |||
def call(source_account, target_account, old_target_account, bypass_locked: false) | |||
@old_target_account = old_target_account | |||
follow = source_account.active_relationships.find_by(target_account: old_target_account) | |||
reblogs = follow&.show_reblogs? | |||
notify = follow&.notify? | |||
languages = follow&.languages | |||
super(source_account, target_account, reblogs: reblogs, notify: notify, languages: languages, bypass_locked: bypass_locked, bypass_limit: true) | |||
end | |||
private | |||
def request_follow! | |||
follow_request = @source_account.request_follow!(@target_account, **follow_options.merge(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') | |||
UnfollowService.new.call(@source_account, @old_target_account, skip_unmerge: true) | |||
elsif @target_account.activitypub? | |||
ActivityPub::MigratedFollowDeliveryWorker.perform_async(build_json(follow_request), @source_account.id, @target_account.inbox_url, @old_target_account.id) | |||
end | |||
follow_request | |||
end | |||
def direct_follow! | |||
follow = super | |||
UnfollowService.new.call(@source_account, @old_target_account, skip_unmerge: true) | |||
follow | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
class RemoveDomainsFromFollowersService < BaseService | |||
include Payloadable | |||
def call(source_account, target_domains) | |||
source_account.passive_relationships.where(account_id: Account.where(domain: target_domains)).find_each do |follow| | |||
follow.destroy | |||
create_notification(follow) if source_account.local? && !follow.account.local? && follow.account.activitypub? | |||
end | |||
end | |||
private | |||
def create_notification(follow) | |||
ActivityPub::DeliveryWorker.perform_async(build_json(follow), follow.target_account_id, follow.account.inbox_url) | |||
end | |||
def build_json(follow) | |||
Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)) | |||
end | |||
end |
@ -0,0 +1,17 @@ | |||
# frozen_string_literal: true | |||
class ActivityPub::MigratedFollowDeliveryWorker < ActivityPub::DeliveryWorker | |||
def perform(json, source_account_id, inbox_url, old_target_account_id, options = {}) | |||
super(json, source_account_id, inbox_url, options) | |||
unfollow_old_account!(old_target_account_id) | |||
end | |||
private | |||
def unfollow_old_account!(old_target_account_id) | |||
old_target_account = Account.find(old_target_account_id) | |||
UnfollowService.new.call(@source_account, old_target_account, skip_unmerge: true) | |||
rescue | |||
true | |||
end | |||
end |
@ -0,0 +1 @@ | |||
Redis.sadd_returns_boolean = false |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::AccountActionsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #new' do | |||
let(:account) { Fabricate(:account) } | |||
it 'returns http success' do | |||
get :new, params: { account_id: account.id } | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::AnnouncementsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::FollowRecommendationsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::IpBlocksController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::RelationshipsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
let(:account) { Fabricate(:account) } | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id } | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::RelaysController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::RulesController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Settings::AboutController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Settings::AppearanceController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Settings::ContentRetentionController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Settings::DiscoveryController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Settings::RegistrationsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::SiteUploadsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'DELETE #destroy' do | |||
let(:site_upload) { Fabricate(:site_upload, var: 'thumbnail') } | |||
it 'returns http success' do | |||
delete :destroy, params: { id: site_upload.id } | |||
expect(response).to redirect_to(admin_settings_path) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Trends::Links::PreviewCardProvidersController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Trends::LinksController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Trends::StatusesController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Trends::TagsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::WarningPresetsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::Webhooks::SecretsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'POST #rotate' do | |||
let(:webhook) { Fabricate(:webhook) } | |||
it 'returns http success' do | |||
post :rotate, params: { webhook_id: webhook.id } | |||
expect(response).to redirect_to(admin_webhook_path(webhook)) | |||
end | |||
end | |||
end |
@ -0,0 +1,21 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Admin::WebhooksController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
before do | |||
sign_in user, scope: :user | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(:success) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Accounts::FamiliarFollowersController do | |||
render_views | |||
let(:user) { Fabricate(:user) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:follows') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Accounts::FeaturedTagsController do | |||
render_views | |||
let(:user) { Fabricate(:user) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Accounts::IdentityProofsController do | |||
render_views | |||
let(:user) { Fabricate(:user) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Accounts::LookupController do | |||
render_views | |||
let(:user) { Fabricate(:user) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show, params: { account_id: account.id, acct: account.acct } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::CanonicalEmailBlocksController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::DimensionsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'POST #create' do | |||
it 'returns http success' do | |||
post :create, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::EmailDomainBlocksController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::IpBlocksController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::MeasuresController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'POST #create' do | |||
it 'returns http success' do | |||
post :create, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::RetentionController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'POST #create' do | |||
it 'returns http success' do | |||
post :create, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::Trends::LinksController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::Trends::StatusesController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Admin::Trends::TagsController do | |||
render_views | |||
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::DirectoriesController do | |||
render_views | |||
let(:user) { Fabricate(:user) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:follows') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::FeaturedTags::SuggestionsController do | |||
render_views | |||
let(:user) { Fabricate(:user) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::FeaturedTagsController do | |||
render_views | |||
let(:user) { Fabricate(:user) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index, params: { account_id: account.id, limit: 2 } | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,16 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Instances::DomainBlocksController do | |||
render_views | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
Setting.show_domain_blocks = 'all' | |||
get :index | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,15 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Instances::ExtendedDescriptionsController do | |||
render_views | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,15 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Instances::PrivacyPoliciesController do | |||
render_views | |||
describe 'GET #show' do | |||
it 'returns http success' do | |||
get :show | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,15 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::Instances::RulesController do | |||
render_views | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |
@ -0,0 +1,23 @@ | |||
# frozen_string_literal: true | |||
require 'rails_helper' | |||
describe Api::V1::PreferencesController do | |||
render_views | |||
let(:user) { Fabricate(:user) } | |||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:accounts') } | |||
let(:account) { Fabricate(:account) } | |||
before do | |||
allow(controller).to receive(:doorkeeper_token) { token } | |||
end | |||
describe 'GET #index' do | |||
it 'returns http success' do | |||
get :index | |||
expect(response).to have_http_status(200) | |||
end | |||
end | |||
end |