FIX: never attempt to log invalid post numbers

Previously in some cases we would queue logging of invalid post numbers

The impact would be we would miss logging an incoming link and would leak
an error.
This commit is contained in:
Sam
2018-11-21 11:58:47 +11:00
parent 86255faa08
commit 20268385a5
4 changed files with 23 additions and 3 deletions

View File

@ -1095,6 +1095,18 @@ RSpec.describe TopicsController do
end.to change(TopicViewItem, :count).by(1)
end
it 'records a view to invalid post_number' do
user = Fabricate(:user)
expect do
get "/t/#{topic.slug}/#{topic.id}/#{256**4}", params: {
u: user.username
}
expect(response.status).to eq(200)
end.to change { IncomingLink.count }.by(1)
end
it 'records incoming links' do
user = Fabricate(:user)