Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `streaming/index.js`: Filtering code for streaming notifications has been refactored upstream, but glitch-soc had similar code for local-only toots in the same places. Ported upstream changes, but did not refactor local-only filtering.
This commit is contained in:
42
spec/lib/permalink_redirector_spec.rb
Normal file
42
spec/lib/permalink_redirector_spec.rb
Normal file
@ -0,0 +1,42 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe PermalinkRedirector do
|
||||
describe '#redirect_url' do
|
||||
before do
|
||||
account = Fabricate(:account, username: 'alice', id: 1)
|
||||
Fabricate(:status, account: account, id: 123)
|
||||
end
|
||||
|
||||
it 'returns path for legacy account links' do
|
||||
redirector = described_class.new('web/accounts/1')
|
||||
expect(redirector.redirect_path).to eq 'https://cb6e6126.ngrok.io/@alice'
|
||||
end
|
||||
|
||||
it 'returns path for legacy status links' do
|
||||
redirector = described_class.new('web/statuses/123')
|
||||
expect(redirector.redirect_path).to eq 'https://cb6e6126.ngrok.io/@alice/123'
|
||||
end
|
||||
|
||||
it 'returns path for legacy tag links' do
|
||||
redirector = described_class.new('web/timelines/tag/hoge')
|
||||
expect(redirector.redirect_path).to eq '/tags/hoge'
|
||||
end
|
||||
|
||||
it 'returns path for pretty account links' do
|
||||
redirector = described_class.new('web/@alice')
|
||||
expect(redirector.redirect_path).to eq 'https://cb6e6126.ngrok.io/@alice'
|
||||
end
|
||||
|
||||
it 'returns path for pretty status links' do
|
||||
redirector = described_class.new('web/@alice/123')
|
||||
expect(redirector.redirect_path).to eq 'https://cb6e6126.ngrok.io/@alice/123'
|
||||
end
|
||||
|
||||
it 'returns path for pretty tag links' do
|
||||
redirector = described_class.new('web/tags/hoge')
|
||||
expect(redirector.redirect_path).to eq '/tags/hoge'
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user