mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: allow local oneboxes to public topics/posts in PM
This commit is contained in:
@@ -100,35 +100,45 @@ describe OneboxController do
|
||||
describe "local onebox" do
|
||||
|
||||
it 'does not cache local oneboxes' do
|
||||
post1 = create_post
|
||||
url = Discourse.base_url + post1.url
|
||||
post = create_post
|
||||
url = Discourse.base_url + post.url
|
||||
|
||||
get :show, params: { url: url, category_id: post1.topic.category_id }, format: :json
|
||||
get :show, params: { url: url, category_id: post.topic.category_id }, format: :json
|
||||
expect(response.body).to include('blockquote')
|
||||
|
||||
post1.trash!
|
||||
post.trash!
|
||||
|
||||
get :show, params: { url: url, category_id: post1.topic.category_id }, format: :json
|
||||
get :show, params: { url: url, category_id: post.topic.category_id }, format: :json
|
||||
expect(response.body).not_to include('blockquote')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
it 'does not onebox when you have no permission on category' do
|
||||
log_in
|
||||
|
||||
it 'does not onebox when you have no permission on category' do
|
||||
log_in
|
||||
post = create_post
|
||||
url = Discourse.base_url + post.url
|
||||
|
||||
post1 = create_post
|
||||
url = Discourse.base_url + post1.url
|
||||
get :show, params: { url: url, category_id: post.topic.category_id }, format: :json
|
||||
expect(response.body).to include('blockquote')
|
||||
|
||||
get :show, params: { url: url, category_id: post1.topic.category_id }, format: :json
|
||||
expect(response.body).to include('blockquote')
|
||||
post.topic.category.set_permissions(staff: :full)
|
||||
post.topic.category.save
|
||||
|
||||
post1.topic.category.set_permissions(staff: :full)
|
||||
post1.topic.category.save
|
||||
get :show, params: { url: url, category_id: post.topic.category_id }, format: :json
|
||||
expect(response.body).not_to include('blockquote')
|
||||
end
|
||||
|
||||
it 'allows onebox to public topics/posts in PM' do
|
||||
log_in
|
||||
|
||||
post = create_post
|
||||
url = Discourse.base_url + post.url
|
||||
|
||||
get :show, params: { url: url }, format: :json
|
||||
expect(response.body).to include('blockquote')
|
||||
end
|
||||
|
||||
get :show, params: { url: url, category_id: post1.topic.category_id }, format: :json
|
||||
expect(response.body).not_to include('blockquote')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user