This commit is contained in:
aus-social 2018-10-04 20:36:53 +10:00 committed by Eugen Rochko
parent 928102284a
commit 1f98eae1cf
56 changed files with 55 additions and 79 deletions

View file

@ -62,5 +62,4 @@ Devise.setup do |config|
saml_options[:uid_attribute] = ENV['SAML_UID_ATTRIBUTE'] if ENV['SAML_UID_ATTRIBUTE'] saml_options[:uid_attribute] = ENV['SAML_UID_ATTRIBUTE'] if ENV['SAML_UID_ATTRIBUTE']
config.omniauth :saml, saml_options config.omniauth :saml, saml_options
end end
end end

View file

@ -1,6 +1,5 @@
module Twitter module Twitter
class Regex class Regex
REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}\(\)\?]/iou REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}\(\)\?]/iou
REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou
REGEXEN[:valid_url_balanced_parens] = / REGEXEN[:valid_url_balanced_parens] = /

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
Rails.application.configure do Rails.application.configure do
# You can generate the keys using the following command (first is the private key, second is the public one) # You can generate the keys using the following command (first is the private key, second is the public one)
# You should only generate this once per instance. If you later decide to change it, all push subscription will # You should only generate this once per instance. If you later decide to change it, all push subscription will
# be invalidated, requiring the users to access the website again to resubscribe. # be invalidated, requiring the users to access the website again to resubscribe.

View file

@ -1,5 +1,4 @@
class ChangeTagSearchIndexToBtree < ActiveRecord::Migration[5.1] class ChangeTagSearchIndexToBtree < ActiveRecord::Migration[5.1]
def up def up
remove_index :tags, name: :hashtag_search_index remove_index :tags, name: :hashtag_search_index
execute 'CREATE INDEX hashtag_search_index ON tags (name text_pattern_ops);' execute 'CREATE INDEX hashtag_search_index ON tags (name text_pattern_ops);'

View file

@ -11,7 +11,6 @@
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_08_20_232245) do ActiveRecord::Schema.define(version: 2018_08_20_232245) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"

View file

@ -75,7 +75,6 @@ RSpec.describe Admin::AccountsController, type: :controller do
end end
end end
describe 'POST #subscribe' do describe 'POST #subscribe' do
subject { post :subscribe, params: { id: account.id } } subject { post :subscribe, params: { id: account.id } }

View file

@ -40,7 +40,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do
describe 'POST #create' do describe 'POST #create' do
it 'blocks the domain when succeeded to save' do it 'blocks the domain when succeeded to save' do
post :create, params: { email_domain_block: { domain: 'example.com'} } post :create, params: { email_domain_block: { domain: 'example.com' } }
expect(flash[:notice]).to eq I18n.t('admin.email_domain_blocks.created_msg') expect(flash[:notice]).to eq I18n.t('admin.email_domain_blocks.created_msg')
expect(response).to redirect_to(admin_email_domain_blocks_path) expect(response).to redirect_to(admin_email_domain_blocks_path)

View file

@ -24,7 +24,7 @@ describe Admin::InvitesController do
subject { post :create, params: { invite: { max_uses: '10', expires_in: 1800 } } } subject { post :create, params: { invite: { max_uses: '10', expires_in: 1800 } } }
it 'succeeds to create a invite' do it 'succeeds to create a invite' do
expect{ subject }.to change { Invite.count }.by(1) expect { subject }.to change { Invite.count }.by(1)
expect(subject).to redirect_to admin_invites_path expect(subject).to redirect_to admin_invites_path
expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10) expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10)
end end

View file

@ -15,7 +15,6 @@ describe Admin::ReportNotesController do
let(:report) { Fabricate(:report, action_taken: action_taken, action_taken_by_account_id: account_id) } let(:report) { Fabricate(:report, action_taken: action_taken, action_taken_by_account_id: account_id) }
context 'when parameter is valid' do context 'when parameter is valid' do
context 'when report is unsolved' do context 'when report is unsolved' do
let(:action_taken) { false } let(:action_taken) { false }
let(:account_id) { nil } let(:account_id) { nil }
@ -24,7 +23,7 @@ describe Admin::ReportNotesController do
let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } } let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } }
it 'creates a report note and resolves report' do it 'creates a report note and resolves report' do
expect{ subject }.to change{ ReportNote.count }.by(1) expect { subject }.to change { ReportNote.count }.by(1)
expect(report.reload).to be_action_taken expect(report.reload).to be_action_taken
expect(subject).to redirect_to admin_reports_path expect(subject).to redirect_to admin_reports_path
end end
@ -34,7 +33,7 @@ describe Admin::ReportNotesController do
let(:params) { { report_note: { content: 'test content', report_id: report.id } } } let(:params) { { report_note: { content: 'test content', report_id: report.id } } }
it 'creates a report note and does not resolve report' do it 'creates a report note and does not resolve report' do
expect{ subject }.to change{ ReportNote.count }.by(1) expect { subject }.to change { ReportNote.count }.by(1)
expect(report.reload).not_to be_action_taken expect(report.reload).not_to be_action_taken
expect(subject).to redirect_to admin_report_path(report) expect(subject).to redirect_to admin_report_path(report)
end end
@ -49,7 +48,7 @@ describe Admin::ReportNotesController do
let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } } let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } }
it 'creates a report note and unresolves report' do it 'creates a report note and unresolves report' do
expect{ subject }.to change{ ReportNote.count }.by(1) expect { subject }.to change { ReportNote.count }.by(1)
expect(report.reload).not_to be_action_taken expect(report.reload).not_to be_action_taken
expect(subject).to redirect_to admin_report_path(report) expect(subject).to redirect_to admin_report_path(report)
end end
@ -59,7 +58,7 @@ describe Admin::ReportNotesController do
let(:params) { { report_note: { content: 'test content', report_id: report.id } } } let(:params) { { report_note: { content: 'test content', report_id: report.id } } }
it 'creates a report note and does not unresolve report' do it 'creates a report note and does not unresolve report' do
expect{ subject }.to change{ ReportNote.count }.by(1) expect { subject }.to change { ReportNote.count }.by(1)
expect(report.reload).to be_action_taken expect(report.reload).to be_action_taken
expect(subject).to redirect_to admin_report_path(report) expect(subject).to redirect_to admin_report_path(report)
end end
@ -84,7 +83,7 @@ describe Admin::ReportNotesController do
let!(:report_note) { Fabricate(:report_note) } let!(:report_note) { Fabricate(:report_note) }
it 'deletes note' do it 'deletes note' do
expect{ subject }.to change{ ReportNote.count }.by(-1) expect { subject }.to change { ReportNote.count }.by(-1)
expect(subject).to redirect_to admin_report_path(report_note.report) expect(subject).to redirect_to admin_report_path(report_note.report)
end end
end end

View file

@ -154,7 +154,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
before do before do
user.account.follow!(other_account) user.account.follow!(other_account)
post :mute, params: {id: other_account.id } post :mute, params: { id: other_account.id }
end end
it 'returns http success' do it 'returns http success' do
@ -182,7 +182,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
before do before do
user.account.follow!(other_account) user.account.follow!(other_account)
post :mute, params: {id: other_account.id, notifications: false } post :mute, params: { id: other_account.id, notifications: false }
end end
it 'returns http success' do it 'returns http success' do

View file

@ -25,7 +25,6 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control
expect(response.headers['Link'].links.size).to eq(2) expect(response.headers['Link'].links.size).to eq(2)
end end
end end
end end
context 'without an oauth token' do context 'without an oauth token' do

View file

@ -31,7 +31,7 @@ describe Api::V1::StreamingController do
describe 'GET #index' do describe 'GET #index' do
it 'redirects to streaming host' do it 'redirects to streaming host' do
get :index, params: {access_token: 'deadbeef', stream: 'public'} get :index, params: { access_token: 'deadbeef', stream: 'public' }
expect(response).to have_http_status(301) expect(response).to have_http_status(301)
request_uri = URI.parse(request.url) request_uri = URI.parse(request.url)
redirect_to_uri = URI.parse(response.location) redirect_to_uri = URI.parse(response.location)
@ -42,5 +42,4 @@ describe Api::V1::StreamingController do
end end
end end
end end
end end

View file

@ -14,7 +14,7 @@ describe Api::Web::EmbedsController do
context 'when successfully finds status' do context 'when successfully finds status' do
let(:status) { Fabricate(:status) } let(:status) { Fabricate(:status) }
let(:url) { "http://#{ Rails.configuration.x.web_domain }/@#{status.account.username}/#{status.id}" } let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" }
it 'returns a right response' do it 'returns a right response' do
expect(response).to have_http_status :ok expect(response).to have_http_status :ok

View file

@ -94,7 +94,7 @@ describe ApplicationController, type: :controller do
describe 'helper_method :current_theme' do describe 'helper_method :current_theme' do
it 'returns "default" when theme wasn\'t changed in admin settings' do it 'returns "default" when theme wasn\'t changed in admin settings' do
allow(Setting).to receive(:default_settings).and_return({'theme' => 'default'}) allow(Setting).to receive(:default_settings).and_return({ 'theme' => 'default' })
expect(controller.view_context.current_theme).to eq 'default' expect(controller.view_context.current_theme).to eq 'default'
end end
@ -197,7 +197,7 @@ describe ApplicationController, type: :controller do
describe 'raise_not_found' do describe 'raise_not_found' do
it 'raises error' do it 'raises error' do
controller.params[:unmatched_route] = 'unmatched' controller.params[:unmatched_route] = 'unmatched'
expect{ controller.raise_not_found }.to raise_error(ActionController::RoutingError, 'No route matches unmatched') expect { controller.raise_not_found }.to raise_error(ActionController::RoutingError, 'No route matches unmatched')
end end
end end

View file

@ -67,7 +67,7 @@ describe Auth::ConfirmationsController, type: :controller do
end end
describe 'PATCH #finish_signup' do describe 'PATCH #finish_signup' do
subject { patch :finish_signup, params: { user: { email: email }} } subject { patch :finish_signup, params: { user: { email: email } } }
let(:user) { Fabricate(:user) } let(:user) { Fabricate(:user) }
before do before do

View file

@ -43,7 +43,7 @@ describe InvitesController do
let(:user) { Fabricate(:user, moderator: false, admin: true) } let(:user) { Fabricate(:user, moderator: false, admin: true) }
it 'succeeds to create a invite' do it 'succeeds to create a invite' do
expect{ subject }.to change { Invite.count }.by(1) expect { subject }.to change { Invite.count }.by(1)
expect(subject).to redirect_to invites_path expect(subject).to redirect_to invites_path
expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10) expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10)
end end

View file

@ -14,11 +14,11 @@ describe RemoteUnfollowsController do
before do before do
sign_in current_user sign_in current_user
current_account.follow!(remote_account) current_account.follow!(remote_account)
stub_request(:post, 'http://example.com/inbox'){ { status: 200 } } stub_request(:post, 'http://example.com/inbox') { { status: 200 } }
end end
context 'when successfully unfollow remote account' do context 'when successfully unfollow remote account' do
let(:acct) {"acct:#{ remote_account.username }@#{ remote_account.domain }"} let(:acct) { "acct:#{remote_account.username}@#{remote_account.domain}" }
it do it do
is_expected.to render_template :success is_expected.to render_template :success
@ -27,7 +27,7 @@ describe RemoteUnfollowsController do
end end
context 'when fails to unfollow remote account' do context 'when fails to unfollow remote account' do
let(:acct) {"acct:#{ remote_account.username + '_test' }@#{ remote_account.domain }"} let(:acct) { "acct:#{remote_account.username + '_test'}@#{remote_account.domain}" }
it do it do
is_expected.to render_template :error is_expected.to render_template :error

View file

@ -21,7 +21,6 @@ describe Settings::ApplicationsController do
end end
end end
describe 'GET #show' do describe 'GET #show' do
it 'returns http success' do it 'returns http success' do
get :show, params: { id: app.id } get :show, params: { id: app.id }

View file

@ -10,7 +10,6 @@ describe Settings::MigrationsController do
end end
describe 'GET #show' do describe 'GET #show' do
context 'when user is not sign in' do context 'when user is not sign in' do
subject { get :show } subject { get :show }
@ -45,7 +44,6 @@ describe Settings::MigrationsController do
end end
describe 'PUT #update' do describe 'PUT #update' do
context 'when user is not sign in' do context 'when user is not sign in' do
subject { put :update } subject { put :update }

View file

@ -50,7 +50,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
describe 'when form_two_factor_confirmation parameter is not provided' do describe 'when form_two_factor_confirmation parameter is not provided' do
it 'raises ActionController::ParameterMissing' do it 'raises ActionController::ParameterMissing' do
expect { post :create, params: { } }.to raise_error(ActionController::ParameterMissing) expect { post :create, params: {} }.to raise_error(ActionController::ParameterMissing)
end end
end end

View file

@ -6,5 +6,5 @@ Fabricator(:account) do
username { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } } username { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } }
last_webfingered_at { Time.now.utc } last_webfingered_at { Time.now.utc }
public_key { public_key } public_key { public_key }
private_key { private_key} private_key { private_key }
end end

View file

@ -1,3 +1,2 @@
Fabricator(:site_upload) do Fabricator(:site_upload) do
end end

View file

@ -170,7 +170,6 @@ RSpec.describe Formatter do
end end
end end
describe '#format_spoiler' do describe '#format_spoiler' do
subject { Formatter.instance.format_spoiler(status) } subject { Formatter.instance.format_spoiler(status) }

View file

@ -880,7 +880,7 @@ RSpec.describe OStatus::AtomSerializer do
ProcessInteractionService.new.call(envelope, block.target_account) ProcessInteractionService.new.call(envelope, block.target_account)
expect{ block.reload }.to raise_error ActiveRecord::RecordNotFound expect { block.reload }.to raise_error ActiveRecord::RecordNotFound
end end
end end

View file

@ -84,7 +84,7 @@ describe Request do
allow(Addrinfo).to receive(:foreach).with('example.com', nil, nil, :SOCK_STREAM) allow(Addrinfo).to receive(:foreach).with('example.com', nil, nil, :SOCK_STREAM)
.and_yield(Addrinfo.new(["AF_INET", 0, "example.com", "0.0.0.0"], :PF_INET, :SOCK_STREAM)) .and_yield(Addrinfo.new(["AF_INET", 0, "example.com", "0.0.0.0"], :PF_INET, :SOCK_STREAM))
.and_yield(Addrinfo.new(["AF_INET6", 0, "example.com", "2001:db8::face"], :PF_INET6, :SOCK_STREAM)) .and_yield(Addrinfo.new(["AF_INET6", 0, "example.com", "2001:db8::face"], :PF_INET6, :SOCK_STREAM))
expect{ subject.perform }.to raise_error Mastodon::ValidationError expect { subject.perform }.to raise_error Mastodon::ValidationError
end end
end end
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe AccountModerationNote, type: :model do RSpec.describe AccountModerationNote, type: :model do
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe Admin::ActionLog, type: :model do RSpec.describe Admin::ActionLog, type: :model do
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe Backup, type: :model do RSpec.describe Backup, type: :model do
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe ConversationMute, type: :model do RSpec.describe ConversationMute, type: :model do
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe CustomFilter, type: :model do RSpec.describe CustomFilter, type: :model do
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe ListAccount, type: :model do RSpec.describe ListAccount, type: :model do
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe List, type: :model do RSpec.describe List, type: :model do
end end

View file

@ -131,7 +131,7 @@ RSpec.describe MediaAttachment, type: :model do
expect(media.file.meta["original"]["aspect"]).to eq 1.5 expect(media.file.meta["original"]["aspect"]).to eq 1.5
expect(media.file.meta["small"]["width"]).to eq 490 expect(media.file.meta["small"]["width"]).to eq 490
expect(media.file.meta["small"]["height"]).to eq 327 expect(media.file.meta["small"]["height"]).to eq 327
expect(media.file.meta["small"]["aspect"]).to eq 490.0/327 expect(media.file.meta["small"]["aspect"]).to eq 490.0 / 327
end end
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe Mute, type: :model do RSpec.describe Mute, type: :model do
end end

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe PreviewCard, type: :model do RSpec.describe PreviewCard, type: :model do
end end

View file

@ -34,7 +34,7 @@ RSpec.describe RemoteFollow do
subject { remote_follow.valid? } subject { remote_follow.valid? }
context 'attrs with acct' do context 'attrs with acct' do
let(:attrs) { { acct: 'gargron@quitter.no' }} let(:attrs) { { acct: 'gargron@quitter.no' } }
it do it do
is_expected.to be true is_expected.to be true
@ -42,7 +42,7 @@ RSpec.describe RemoteFollow do
end end
context 'attrs without acct' do context 'attrs without acct' do
let(:attrs) { { } } let(:attrs) { {} }
it do it do
is_expected.to be false is_expected.to be false

View file

@ -1,5 +1,4 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe Web::Setting, type: :model do RSpec.describe Web::Setting, type: :model do
end end

View file

@ -34,7 +34,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
end end
it 'processes payload with actor if valid signature exists' do it 'processes payload with actor if valid signature exists' do
payload['signature'] = {'type' => 'RsaSignature2017'} payload['signature'] = { 'type' => 'RsaSignature2017' }
expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(actor) expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(actor)
expect(ActivityPub::Activity).to receive(:factory).with(instance_of(Hash), actor, instance_of(Hash)) expect(ActivityPub::Activity).to receive(:factory).with(instance_of(Hash), actor, instance_of(Hash))
@ -43,7 +43,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
end end
it 'does not process payload if invalid signature exists' do it 'does not process payload if invalid signature exists' do
payload['signature'] = {'type' => 'RsaSignature2017'} payload['signature'] = { 'type' => 'RsaSignature2017' }
expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(nil) expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(nil)
expect(ActivityPub::Activity).not_to receive(:factory) expect(ActivityPub::Activity).not_to receive(:factory)

View file

@ -57,7 +57,7 @@ RSpec.describe FetchAtomService, type: :service do
context 'content type is application/atom+xml' do context 'content type is application/atom+xml' do
let(:content_type) { 'application/atom+xml' } let(:content_type) { 'application/atom+xml' }
it { is_expected.to eq [url, {:prefetched_body=>""}, :ostatus] } it { is_expected.to eq [url, { :prefetched_body => "" }, :ostatus] }
end end
context 'content_type is json' do context 'content_type is json' do

View file

@ -50,7 +50,7 @@ describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true d
assign(:account, alice) assign(:account, alice)
assign(:type, reply.stream_entry.activity_type.downcase) assign(:type, reply.stream_entry.activity_type.downcase)
assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob) ) assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob) )
assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1)}]) assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1) }])
render render