mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 08:48:53 +00:00
Merge commit '877090518682b6c77ba9bdfa0231afd56daec44d' into glitch-soc/merge-upstream
Conflicts: - `app/models/concerns/user/has_settings.rb`: Not a real conflict, upstream added a setting textually close to a glitch-soc one. Added upstream's new setting. - `app/views/settings/preferences/appearance/show.html.haml`: Not a real conflict, upstream added a setting textually close to a glitch-soc one. Added upstream's new setting. - `config/routes.rb`: Upstream moved web app routes to `config/routes/web_app.rb`, while glitch-soc had an extra route. Moved the extra route to `config/routes/web_app.rb`. - `spec/controllers/settings/preferences/appearance_controller_spec.rb`: This spec got converted to a system spec upstream. However, the theme setting works differently in glitch-soc, so the spec had been changed. Changed the corresponding system spec as well.
This commit is contained in:
@@ -160,10 +160,6 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
context 'when fetching' do
|
||||
subject { described_class.new(json, sender) }
|
||||
|
||||
before do
|
||||
subject.perform
|
||||
end
|
||||
|
||||
context 'when object publication date is below ISO8601 range' do
|
||||
let(:object_json) do
|
||||
{
|
||||
@@ -175,6 +171,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status with a valid creation date', :aggregate_failures do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -195,6 +193,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status with a valid creation date', :aggregate_failures do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -216,6 +216,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status with appropriate creation and edition dates', :aggregate_failures do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -239,17 +241,13 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
}
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
it 'creates status and does not mark it as edited' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.text).to eq 'Lorem ipsum'
|
||||
end
|
||||
|
||||
it 'does not mark status as edited' do
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.edited?).to be false
|
||||
end
|
||||
end
|
||||
@@ -264,7 +262,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'does not create a status' do
|
||||
expect(sender.statuses.count).to be_zero
|
||||
expect { subject.perform }.to_not change(sender.statuses, :count)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -278,6 +276,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -285,6 +285,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'missing to/cc defaults to direct privacy' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -303,6 +305,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -321,6 +325,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -339,6 +345,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -357,6 +365,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -375,6 +385,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -393,6 +405,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -411,6 +425,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -433,6 +449,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -452,15 +470,13 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
}
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
it 'creates status with a silent mention' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.visibility).to eq 'limited'
|
||||
end
|
||||
|
||||
it 'creates silent mention' do
|
||||
status = sender.statuses.first
|
||||
expect(status.mentions.first).to be_silent
|
||||
end
|
||||
end
|
||||
@@ -483,6 +499,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status with limited visibility' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -507,6 +525,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status with direct visibility' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -528,6 +548,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -548,6 +570,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -576,6 +600,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -598,6 +624,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
expect(status).to_not be_nil
|
||||
end
|
||||
@@ -625,6 +653,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status with correctly-ordered media attachments' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -651,6 +681,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -676,6 +708,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -701,6 +735,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -724,6 +760,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
expect(status).to_not be_nil
|
||||
end
|
||||
@@ -746,6 +784,42 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.tags.map(&:name)).to include('test')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with featured hashtags' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
tag: [
|
||||
{
|
||||
type: 'Hashtag',
|
||||
href: 'http://example.com/blah',
|
||||
name: '#test',
|
||||
},
|
||||
],
|
||||
}
|
||||
end
|
||||
|
||||
before do
|
||||
sender.featured_tags.create!(name: 'test')
|
||||
end
|
||||
|
||||
it 'creates status and updates featured tag' do
|
||||
expect { subject.perform }
|
||||
.to change(sender.statuses, :count).by(1)
|
||||
.and change { sender.featured_tags.first.reload.statuses_count }.by(1)
|
||||
.and change { sender.featured_tags.first.reload.last_status_at }.from(nil).to(be_within(0.1).of(Time.now.utc))
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -769,6 +843,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
expect(status).to_not be_nil
|
||||
end
|
||||
@@ -791,6 +867,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
expect(status).to_not be_nil
|
||||
end
|
||||
@@ -815,6 +893,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -841,6 +921,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
@@ -866,6 +948,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
expect(status).to_not be_nil
|
||||
end
|
||||
@@ -887,6 +971,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
expect(status).to_not be_nil
|
||||
end
|
||||
@@ -917,13 +1003,13 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
}
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
it 'creates status with a poll' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
expect(status).to_not be_nil
|
||||
expect(status.poll).to_not be_nil
|
||||
end
|
||||
|
||||
it 'creates a poll' do
|
||||
poll = sender.polls.first
|
||||
expect(poll).to_not be_nil
|
||||
expect(poll.status).to_not be_nil
|
||||
@@ -946,6 +1032,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'adds a vote to the poll with correct uri' do
|
||||
expect { subject.perform }.to change(poll.votes, :count).by(1)
|
||||
|
||||
vote = poll.votes.first
|
||||
expect(vote).to_not be_nil
|
||||
expect(vote.uri).to eq object_json[:id]
|
||||
@@ -955,9 +1043,9 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
|
||||
context 'when a vote to an expired local poll' do
|
||||
let(:poll) do
|
||||
poll = Fabricate.build(:poll, options: %w(Yellow Blue), expires_at: 1.day.ago)
|
||||
poll.save(validate: false)
|
||||
poll
|
||||
travel_to 2.days.ago do
|
||||
Fabricate(:poll, options: %w(Yellow Blue), expires_at: 1.day.from_now)
|
||||
end
|
||||
end
|
||||
let!(:local_status) { Fabricate(:status, poll: poll) }
|
||||
|
||||
@@ -971,6 +1059,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'does not add a vote to the poll' do
|
||||
expect { subject.perform }.to_not change(poll.votes, :count)
|
||||
|
||||
expect(poll.votes.first).to be_nil
|
||||
end
|
||||
end
|
||||
@@ -995,6 +1085,8 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
|
||||
it 'uses the counts from the created object' do
|
||||
expect { subject.perform }.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
expect(status.untrusted_favourites_count).to eq 50
|
||||
expect(status.untrusted_reblogs_count).to eq 100
|
||||
|
||||
Reference in New Issue
Block a user