|
|
|
|
@ -35,17 +35,16 @@ describe MoveWorker do
|
|
|
|
|
context 'when user notes are short enough' do
|
|
|
|
|
it 'copies user note with prelude' do
|
|
|
|
|
subject.perform(source_account.id, target_account.id)
|
|
|
|
|
expect(AccountNote.find_by(account: account_note.account, target_account: target_account).comment).to include(source_account.acct)
|
|
|
|
|
expect(AccountNote.find_by(account: account_note.account, target_account: target_account).comment).to include(account_note.comment)
|
|
|
|
|
expect(relevant_account_note.comment)
|
|
|
|
|
.to include(source_account.acct, account_note.comment)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'merges user notes when needed' do
|
|
|
|
|
new_account_note = AccountNote.create!(account: account_note.account, target_account: target_account, comment: 'new note prior to move')
|
|
|
|
|
|
|
|
|
|
subject.perform(source_account.id, target_account.id)
|
|
|
|
|
expect(AccountNote.find_by(account: account_note.account, target_account: target_account).comment).to include(source_account.acct)
|
|
|
|
|
expect(AccountNote.find_by(account: account_note.account, target_account: target_account).comment).to include(account_note.comment)
|
|
|
|
|
expect(AccountNote.find_by(account: account_note.account, target_account: target_account).comment).to include(new_account_note.comment)
|
|
|
|
|
expect(relevant_account_note.comment)
|
|
|
|
|
.to include(source_account.acct, account_note.comment, new_account_note.comment)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@ -54,16 +53,24 @@ describe MoveWorker do
|
|
|
|
|
|
|
|
|
|
it 'copies user note without prelude' do
|
|
|
|
|
subject.perform(source_account.id, target_account.id)
|
|
|
|
|
expect(AccountNote.find_by(account: account_note.account, target_account: target_account).comment).to include(account_note.comment)
|
|
|
|
|
expect(relevant_account_note.comment)
|
|
|
|
|
.to include(account_note.comment)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'keeps user notes unchanged' do
|
|
|
|
|
new_account_note = AccountNote.create!(account: account_note.account, target_account: target_account, comment: 'new note prior to move')
|
|
|
|
|
|
|
|
|
|
subject.perform(source_account.id, target_account.id)
|
|
|
|
|
expect(AccountNote.find_by(account: account_note.account, target_account: target_account).comment).to include(new_account_note.comment)
|
|
|
|
|
expect(relevant_account_note.comment)
|
|
|
|
|
.to include(new_account_note.comment)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def relevant_account_note
|
|
|
|
|
AccountNote.find_by(account: account_note.account, target_account: target_account)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
shared_examples 'block and mute handling' do
|
|
|
|
|
@ -71,10 +78,19 @@ describe MoveWorker do
|
|
|
|
|
subject.perform(source_account.id, target_account.id)
|
|
|
|
|
|
|
|
|
|
expect(block_service).to have_received(:call).with(blocking_account, target_account)
|
|
|
|
|
expect(AccountNote.find_by(account: blocking_account, target_account: target_account).comment).to include(source_account.acct)
|
|
|
|
|
|
|
|
|
|
expect(muting_account.muting?(target_account)).to be true
|
|
|
|
|
expect(AccountNote.find_by(account: muting_account, target_account: target_account).comment).to include(source_account.acct)
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
[note_account_comment, mute_account_comment]
|
|
|
|
|
).to all include(source_account.acct)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def note_account_comment
|
|
|
|
|
AccountNote.find_by(account: blocking_account, target_account: target_account).comment
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def mute_account_comment
|
|
|
|
|
AccountNote.find_by(account: muting_account, target_account: target_account).comment
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|