* Fix mastodon version * テーブル作成 * Wip: フレンドサーバーフォローの承認を受信 * Wip: フレンド申請拒否を受信 * Wip: フォローリクエストを受理 * Wip: 相手からのフォロー・アンフォローを受理 * 普通のフォローとフレンドサーバーのフォローを区別するテストを追加 * ドメインブロックによるフォロー拒否 * ドメインブロックしたあと、申請中のフォロリクを取り下げる処理 * スタブに条件を追加 * Wip: 相手からのDelete信号に対応 * DB定義が消えていたので修正 * Wip: ローカル公開投稿をフレンドに送信する処理など * Wip: 未収載+誰でもの投稿をフレンドに送る設定 * Wip: ローカル公開をそのまま送信する設定を考慮 * Fix test * Wip: 他サーバーからのローカル公開投稿の受け入れ * Wip: Web画面作成 * Fix test * Wip: ローカル公開を連合TLに流す * Wip: フレンドサーバーの削除ボタン * Wip: メール通知や設定のテストなど * Wip: 翻訳を作成 * Fix: 却下されたあとフォローボタンが表示されない問題 * Wip: 編集できない問題 * 有効にしていないフレンドサーバーをリストで無効表示
83 lines
2.6 KiB
Ruby
83 lines
2.6 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe FriendDomain do
|
|
let(:friend) { Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox') }
|
|
|
|
before do
|
|
stub_request(:post, 'https://foo.bar/inbox')
|
|
end
|
|
|
|
describe '#follow!' do
|
|
it 'call inbox' do
|
|
friend.follow!
|
|
expect(friend.active_follow_activity_id).to_not be_nil
|
|
expect(friend.i_am_pending?).to be true
|
|
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
|
|
id: friend.active_follow_activity_id,
|
|
type: 'Follow',
|
|
actor: 'https://cb6e6126.ngrok.io/actor',
|
|
object: 'https://www.w3.org/ns/activitystreams#Public',
|
|
}))).to have_been_made.once
|
|
end
|
|
end
|
|
|
|
describe '#unfollow!' do
|
|
it 'call inbox' do
|
|
friend.update(active_follow_activity_id: 'ohagi')
|
|
friend.unfollow!
|
|
expect(friend.active_follow_activity_id).to be_nil
|
|
expect(friend.i_am_idle?).to be true
|
|
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
|
|
type: 'Undo',
|
|
object: {
|
|
id: 'ohagi',
|
|
type: 'Follow',
|
|
actor: 'https://cb6e6126.ngrok.io/actor',
|
|
object: 'https://www.w3.org/ns/activitystreams#Public',
|
|
},
|
|
}))).to have_been_made.once
|
|
end
|
|
end
|
|
|
|
describe '#accept!' do
|
|
it 'call inbox' do
|
|
friend.update(passive_follow_activity_id: 'ohagi', passive_state: :pending)
|
|
friend.accept!
|
|
expect(friend.they_are_accepted?).to be true
|
|
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
|
|
id: 'ohagi#accepts/friends',
|
|
type: 'Accept',
|
|
actor: 'https://cb6e6126.ngrok.io/actor',
|
|
object: 'ohagi',
|
|
}))).to have_been_made.once
|
|
end
|
|
end
|
|
|
|
describe '#reject!' do
|
|
it 'call inbox' do
|
|
friend.update(passive_follow_activity_id: 'ohagi', passive_state: :pending)
|
|
friend.reject!
|
|
expect(friend.they_are_rejected?).to be true
|
|
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
|
|
id: 'ohagi#rejects/friends',
|
|
type: 'Reject',
|
|
actor: 'https://cb6e6126.ngrok.io/actor',
|
|
object: 'ohagi',
|
|
}))).to have_been_made.once
|
|
end
|
|
end
|
|
|
|
describe '#delete!' do
|
|
it 'call inbox' do
|
|
friend.update(active_state: :pending)
|
|
friend.destroy
|
|
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
|
|
type: 'Delete',
|
|
actor: 'https://cb6e6126.ngrok.io/actor',
|
|
object: 'https://www.w3.org/ns/activitystreams#Public',
|
|
}))).to have_been_made.once
|
|
end
|
|
end
|
|
end
|