0
0
Fork 0

Update status embeds (#4742)

- Use statuses controller for embeds instead of stream entries controller
- Prefer /@:username/:id/embed URL for embeds
- Use /@:username as author_url in OEmbed
- Add follow link to embeds which opens web intent in new window
- Use redis cache in development
- Cache entire embed
This commit is contained in:
Eugen Rochko 2017-08-30 10:23:43 +02:00 committed by GitHub
parent fcca31350d
commit e95bdec7c5
15 changed files with 101 additions and 55 deletions

View file

@ -2,17 +2,17 @@
require 'rails_helper'
describe StreamEntryFinder do
describe StatusFinder do
include RoutingHelper
describe '#stream_entry' do
describe '#status' do
context 'with a status url' do
let(:status) { Fabricate(:status) }
let(:url) { short_account_status_url(account_username: status.account.username, id: status.id) }
subject { described_class.new(url) }
it 'finds the stream entry' do
expect(subject.stream_entry).to eq(status.stream_entry)
expect(subject.status).to eq(status)
end
it 'raises an error if action is not :show' do
@ -20,7 +20,7 @@ describe StreamEntryFinder do
expect(recognized).to receive(:[]).with(:action).and_return(:create)
expect(Rails.application.routes).to receive(:recognize_path).with(url).and_return(recognized)
expect { subject.stream_entry }.to raise_error(ActiveRecord::RecordNotFound)
expect { subject.status }.to raise_error(ActiveRecord::RecordNotFound)
end
end
@ -30,7 +30,7 @@ describe StreamEntryFinder do
subject { described_class.new(url) }
it 'finds the stream entry' do
expect(subject.stream_entry).to eq(stream_entry)
expect(subject.status).to eq(stream_entry.status)
end
end
@ -39,7 +39,7 @@ describe StreamEntryFinder do
subject { described_class.new(url) }
it 'raises an error' do
expect { subject.stream_entry }.to raise_error(ActiveRecord::RecordNotFound)
expect { subject.status }.to raise_error(ActiveRecord::RecordNotFound)
end
end
@ -48,7 +48,7 @@ describe StreamEntryFinder do
subject { described_class.new(url) }
it 'raises an error' do
expect { subject.stream_entry }.to raise_error(ActiveRecord::RecordNotFound)
expect { subject.status }.to raise_error(ActiveRecord::RecordNotFound)
end
end
end