From 1294f9ee4fab176bdc3989d667eed43f57baad5a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 May 2021 19:32:58 +0200 Subject: [PATCH 1/3] Remove PubSubHubbub-related columns from accounts table (#16170) --- app/models/account.rb | 14 ++--- ...0507001928_remove_hub_url_from_accounts.rb | 12 +++++ db/schema.rb | 6 +-- .../relationships_controller_spec.rb | 6 +-- .../services/authorize_follow_service_spec.rb | 18 ------- .../batched_remove_status_service_spec.rb | 2 +- spec/services/block_service_spec.rb | 13 ----- spec/services/favourite_service_spec.rb | 14 ----- .../fetch_remote_status_service_spec.rb | 52 ------------------- .../services/process_mentions_service_spec.rb | 31 ----------- spec/services/reblog_service_spec.rb | 16 ------ spec/services/reject_follow_service_spec.rb | 18 ------- spec/services/remove_status_service_spec.rb | 2 +- spec/services/unblock_service_spec.rb | 14 ----- spec/services/unfollow_service_spec.rb | 14 ----- 15 files changed, 24 insertions(+), 208 deletions(-) create mode 100644 db/post_migrate/20210507001928_remove_hub_url_from_accounts.rb diff --git a/app/models/account.rb b/app/models/account.rb index 994459338b..2c5455d8e5 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -6,12 +6,8 @@ # id :bigint(8) not null, primary key # username :string default(""), not null # domain :string -# secret :string default(""), not null # private_key :text # public_key :text default(""), not null -# remote_url :string default(""), not null -# salmon_url :string default(""), not null -# hub_url :string default(""), not null # created_at :datetime not null # updated_at :datetime not null # note :text default(""), not null @@ -49,12 +45,18 @@ # avatar_storage_schema_version :integer # header_storage_schema_version :integer # devices_url :string -# sensitized_at :datetime # suspension_origin :integer +# sensitized_at :datetime # class Account < ApplicationRecord - self.ignored_columns = %w(subscription_expires_at) + self.ignored_columns = %w( + subscription_expires_at + secret + remote_url + salmon_url + hub_url + ) USERNAME_RE = /[a-z0-9_]+([a-z0-9_\.-]+[a-z0-9_]+)?/i MENTION_RE = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]\.\-]+[a-z0-9]+)?)/i diff --git a/db/post_migrate/20210507001928_remove_hub_url_from_accounts.rb b/db/post_migrate/20210507001928_remove_hub_url_from_accounts.rb new file mode 100644 index 0000000000..83a1f5fcf3 --- /dev/null +++ b/db/post_migrate/20210507001928_remove_hub_url_from_accounts.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class RemoveHubURLFromAccounts < ActiveRecord::Migration[5.2] + def change + safety_assured do + remove_column :accounts, :secret, :string, null: false, default: '' + remove_column :accounts, :remote_url, :string, null: false, default: '' + remove_column :accounts, :salmon_url, :string, null: false, default: '' + remove_column :accounts, :hub_url, :string, null: false, default: '' + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 19b1afe00d..583bdf317d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_05_05_174616) do +ActiveRecord::Schema.define(version: 2021_05_07_001928) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -136,12 +136,8 @@ ActiveRecord::Schema.define(version: 2021_05_05_174616) do create_table "accounts", id: :bigint, default: -> { "timestamp_id('accounts'::text)" }, force: :cascade do |t| t.string "username", default: "", null: false t.string "domain" - t.string "secret", default: "", null: false t.text "private_key" t.text "public_key", default: "", null: false - t.string "remote_url", default: "", null: false - t.string "salmon_url", default: "", null: false - t.string "hub_url", default: "", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.text "note", default: "", null: false diff --git a/spec/controllers/relationships_controller_spec.rb b/spec/controllers/relationships_controller_spec.rb index 16e255afe1..2056a2ac29 100644 --- a/spec/controllers/relationships_controller_spec.rb +++ b/spec/controllers/relationships_controller_spec.rb @@ -36,11 +36,7 @@ describe RelationshipsController do end describe 'PATCH #update' do - let(:poopfeast) { Fabricate(:account, username: 'poopfeast', domain: 'example.com', salmon_url: 'http://example.com/salmon') } - - before do - stub_request(:post, 'http://example.com/salmon').to_return(status: 200) - end + let(:poopfeast) { Fabricate(:account, username: 'poopfeast', domain: 'example.com') } shared_examples 'redirects back to followers page' do it 'redirects back to followers page' do diff --git a/spec/services/authorize_follow_service_spec.rb b/spec/services/authorize_follow_service_spec.rb index ce56d57a62..8e5d8fb03a 100644 --- a/spec/services/authorize_follow_service_spec.rb +++ b/spec/services/authorize_follow_service_spec.rb @@ -22,24 +22,6 @@ RSpec.describe AuthorizeFollowService, type: :service do end end - describe 'remote OStatus' do - let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com')).account } - - before do - FollowRequest.create(account: bob, target_account: sender) - stub_request(:post, "http://salmon.example.com/").to_return(:status => 200, :body => "", :headers => {}) - subject.call(bob, sender) - end - - it 'removes follow request' do - expect(bob.requested?(sender)).to be false - end - - it 'creates follow relation' do - expect(bob.following?(sender)).to be true - end - end - describe 'remote ActivityPub' do let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox')).account } diff --git a/spec/services/batched_remove_status_service_spec.rb b/spec/services/batched_remove_status_service_spec.rb index c1f54a6fd2..4203952c60 100644 --- a/spec/services/batched_remove_status_service_spec.rb +++ b/spec/services/batched_remove_status_service_spec.rb @@ -4,7 +4,7 @@ RSpec.describe BatchedRemoveStatusService, type: :service do subject { BatchedRemoveStatusService.new } let!(:alice) { Fabricate(:account) } - let!(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://example.com/salmon') } + let!(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com') } let!(:jeff) { Fabricate(:user).account } let!(:hank) { Fabricate(:account, username: 'hank', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } diff --git a/spec/services/block_service_spec.rb b/spec/services/block_service_spec.rb index de20dd0265..3714f09e9a 100644 --- a/spec/services/block_service_spec.rb +++ b/spec/services/block_service_spec.rb @@ -17,19 +17,6 @@ RSpec.describe BlockService, type: :service do end end - describe 'remote OStatus' do - let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com')).account } - - before do - stub_request(:post, "http://salmon.example.com/").to_return(:status => 200, :body => "", :headers => {}) - subject.call(sender, bob) - end - - it 'creates a blocking relation' do - expect(sender.blocking?(bob)).to be true - end - end - describe 'remote ActivityPub' do let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox')).account } diff --git a/spec/services/favourite_service_spec.rb b/spec/services/favourite_service_spec.rb index 4c29ea77b7..fc7f58eb42 100644 --- a/spec/services/favourite_service_spec.rb +++ b/spec/services/favourite_service_spec.rb @@ -18,20 +18,6 @@ RSpec.describe FavouriteService, type: :service do end end - describe 'remote OStatus' do - let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :ostatus, domain: 'example.com', salmon_url: 'http://salmon.example.com')).account } - let(:status) { Fabricate(:status, account: bob, uri: 'tag:example.com:blahblah') } - - before do - stub_request(:post, "http://salmon.example.com/").to_return(:status => 200, :body => "", :headers => {}) - subject.call(sender, status) - end - - it 'creates a favourite' do - expect(status.favourites.first).to_not be_nil - end - end - describe 'remote ActivityPub' do let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, protocol: :activitypub, username: 'bob', domain: 'example.com', inbox_url: 'http://example.com/inbox')).account } let(:status) { Fabricate(:status, account: bob) } diff --git a/spec/services/fetch_remote_status_service_spec.rb b/spec/services/fetch_remote_status_service_spec.rb index 1c4b4fee26..0e63cc9eba 100644 --- a/spec/services/fetch_remote_status_service_spec.rb +++ b/spec/services/fetch_remote_status_service_spec.rb @@ -31,56 +31,4 @@ RSpec.describe FetchRemoteStatusService, type: :service do expect(status.text).to eq 'Lorem ipsum' end end - - context 'protocol is :ostatus' do - subject { described_class.new } - - before do - Fabricate(:account, username: 'tracer', domain: 'real.domain', remote_url: 'https://real.domain/users/tracer') - end - - it 'does not create status with author at different domain' do - status_body = <<-XML.squish - - - tag:real.domain,2017-04-27:objectId=4487555:objectType=Status - 2017-04-27T13:49:25Z - 2017-04-27T13:49:25Z - http://activitystrea.ms/schema/1.0/note - http://activitystrea.ms/schema/1.0/post - - https://real.domain/users/tracer - http://activitystrea.ms/schema/1.0/person - https://real.domain/users/tracer - tracer - - Overwatch rocks - - XML - - expect(subject.call('https://fake.domain/foo', status_body)).to be_nil - end - - it 'does not create status with wrong id when id uses http format' do - status_body = <<-XML.squish - - - https://other-real.domain/statuses/123 - 2017-04-27T13:49:25Z - 2017-04-27T13:49:25Z - http://activitystrea.ms/schema/1.0/note - http://activitystrea.ms/schema/1.0/post - - https://real.domain/users/tracer - http://activitystrea.ms/schema/1.0/person - https://real.domain/users/tracer - tracer - - Overwatch rocks - - XML - - expect(subject.call('https://real.domain/statuses/456', status_body)).to be_nil - end - end end diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb index c30de8eeb9..3b2f9d6984 100644 --- a/spec/services/process_mentions_service_spec.rb +++ b/spec/services/process_mentions_service_spec.rb @@ -7,37 +7,6 @@ RSpec.describe ProcessMentionsService, type: :service do subject { ProcessMentionsService.new } - context 'OStatus with public toot' do - let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :ostatus, domain: 'example.com', salmon_url: 'http://salmon.example.com') } - - before do - stub_request(:post, remote_user.salmon_url) - subject.call(status) - end - - it 'does not create a mention' do - expect(remote_user.mentions.where(status: status).count).to eq 0 - end - end - - context 'OStatus with private toot' do - let(:visibility) { :private } - let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :ostatus, domain: 'example.com', salmon_url: 'http://salmon.example.com') } - - before do - stub_request(:post, remote_user.salmon_url) - subject.call(status) - end - - it 'does not create a mention' do - expect(remote_user.mentions.where(status: status).count).to eq 0 - end - - it 'does not post to remote user\'s Salmon end point' do - expect(a_request(:post, remote_user.salmon_url)).to_not have_been_made - end - end - context 'ActivityPub' do context do let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } diff --git a/spec/services/reblog_service_spec.rb b/spec/services/reblog_service_spec.rb index 58fb46f0ff..e2077f282a 100644 --- a/spec/services/reblog_service_spec.rb +++ b/spec/services/reblog_service_spec.rb @@ -32,22 +32,6 @@ RSpec.describe ReblogService, type: :service do end end - context 'OStatus' do - let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com') } - let(:status) { Fabricate(:status, account: bob, uri: 'tag:example.com;something:something') } - - subject { ReblogService.new } - - before do - stub_request(:post, 'http://salmon.example.com') - subject.call(alice, status) - end - - it 'creates a reblog' do - expect(status.reblogs.count).to eq 1 - end - end - context 'ActivityPub' do let(:bob) { Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } let(:status) { Fabricate(:status, account: bob) } diff --git a/spec/services/reject_follow_service_spec.rb b/spec/services/reject_follow_service_spec.rb index 1aec060db7..732cb07f7b 100644 --- a/spec/services/reject_follow_service_spec.rb +++ b/spec/services/reject_follow_service_spec.rb @@ -22,24 +22,6 @@ RSpec.describe RejectFollowService, type: :service do end end - describe 'remote OStatus' do - let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com')).account } - - before do - FollowRequest.create(account: bob, target_account: sender) - stub_request(:post, "http://salmon.example.com/").to_return(:status => 200, :body => "", :headers => {}) - subject.call(bob, sender) - end - - it 'removes follow request' do - expect(bob.requested?(sender)).to be false - end - - it 'does not create follow relation' do - expect(bob.following?(sender)).to be false - end - end - describe 'remote ActivityPub' do let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox')).account } diff --git a/spec/services/remove_status_service_spec.rb b/spec/services/remove_status_service_spec.rb index 7ce75b2c72..21fb0cd353 100644 --- a/spec/services/remove_status_service_spec.rb +++ b/spec/services/remove_status_service_spec.rb @@ -4,7 +4,7 @@ RSpec.describe RemoveStatusService, type: :service do subject { RemoveStatusService.new } let!(:alice) { Fabricate(:account, user: Fabricate(:user)) } - let!(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://example.com/salmon') } + let!(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com') } let!(:jeff) { Fabricate(:account) } let!(:hank) { Fabricate(:account, username: 'hank', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } let!(:bill) { Fabricate(:account, username: 'bill', protocol: :activitypub, domain: 'example2.com', inbox_url: 'http://example2.com/inbox') } diff --git a/spec/services/unblock_service_spec.rb b/spec/services/unblock_service_spec.rb index 6350c68344..c43ab24b03 100644 --- a/spec/services/unblock_service_spec.rb +++ b/spec/services/unblock_service_spec.rb @@ -18,20 +18,6 @@ RSpec.describe UnblockService, type: :service do end end - describe 'remote OStatus' do - let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com')).account } - - before do - sender.block!(bob) - stub_request(:post, "http://salmon.example.com/").to_return(:status => 200, :body => "", :headers => {}) - subject.call(sender, bob) - end - - it 'destroys the blocking relation' do - expect(sender.blocking?(bob)).to be false - end - end - describe 'remote ActivityPub' do let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox')).account } diff --git a/spec/services/unfollow_service_spec.rb b/spec/services/unfollow_service_spec.rb index 84b5dafbc4..7f0b575e4d 100644 --- a/spec/services/unfollow_service_spec.rb +++ b/spec/services/unfollow_service_spec.rb @@ -18,20 +18,6 @@ RSpec.describe UnfollowService, type: :service do end end - describe 'remote OStatus' do - let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :ostatus, domain: 'example.com', salmon_url: 'http://salmon.example.com')).account } - - before do - sender.follow!(bob) - stub_request(:post, "http://salmon.example.com/").to_return(:status => 200, :body => "", :headers => {}) - subject.call(sender, bob) - end - - it 'destroys the following relation' do - expect(sender.following?(bob)).to be false - end - end - describe 'remote ActivityPub' do let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox')).account } From 2ad7bf08b4203419114f0051c2544955ce4b1d9a Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 7 May 2021 19:52:40 +0200 Subject: [PATCH 2/3] Bump nodejs version requirement to node 12 (#16175) One of our dependencies, yarg, now requires node 12 or later --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f979382ebe..371195fde8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@tootsuite/mastodon", "license": "AGPL-3.0-or-later", "engines": { - "node": ">=10.13" + "node": ">=12" }, "scripts": { "postversion": "git push --tags", From 81b19e28ff26cbee22f4c6c393391e92d78c61ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 May 2021 22:04:09 +0200 Subject: [PATCH 3/3] Bump hosted-git-info from 2.8.8 to 2.8.9 (#16177) Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f728601376..c0ec8587df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5394,9 +5394,9 @@ homedir-polyfill@^1.0.1: parse-passwd "^1.0.0" hosted-git-info@^2.1.4: - version "2.8.8" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" - integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== hpack.js@^2.1.6: version "2.1.6"