DEV: Make `find_post_using` raise only `Discourse::NotFound` (#16133)
This commit is contained in:
parent
c212af665c
commit
768c80c2a4
|
@ -869,7 +869,7 @@ class PostsController < ApplicationController
|
|||
post = finder.with_deleted.first
|
||||
raise Discourse::NotFound unless post
|
||||
|
||||
post.topic = Topic.with_deleted.find(post.topic_id)
|
||||
post.topic = Topic.with_deleted.find_by(id: post.topic_id)
|
||||
|
||||
if !post.topic ||
|
||||
(
|
||||
|
|
|
@ -16,6 +16,12 @@ shared_examples 'finding and showing post' do
|
|||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "returns 404 when post's topic is deleted" do
|
||||
post.topic.destroy!
|
||||
get url
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
|
||||
context "deleted post" do
|
||||
before do
|
||||
post.trash!(user)
|
||||
|
|
Loading…
Reference in New Issue