mirror of
https://github.com/discourse/discourse.git
synced 2025-02-23 20:37:41 +08:00
parent
3c9f939fb0
commit
95be7f4940
@ -1094,7 +1094,7 @@ Discourse::Application.routes.draw do
|
|||||||
delete "admin/groups/:id/members" => "groups#remove_member", :constraints => AdminConstraint.new
|
delete "admin/groups/:id/members" => "groups#remove_member", :constraints => AdminConstraint.new
|
||||||
put "admin/groups/:id/members" => "groups#add_members", :constraints => AdminConstraint.new
|
put "admin/groups/:id/members" => "groups#add_members", :constraints => AdminConstraint.new
|
||||||
|
|
||||||
resources :posts, only: %i[show update create destroy] do
|
resources :posts, only: %i[show update create destroy], defaults: { format: "json" } do
|
||||||
delete "bookmark", to: "posts#destroy_bookmark"
|
delete "bookmark", to: "posts#destroy_bookmark"
|
||||||
put "wiki"
|
put "wiki"
|
||||||
put "post_type"
|
put "post_type"
|
||||||
|
@ -643,6 +643,24 @@ RSpec.describe PostsController do
|
|||||||
expect(post.topic.reload.category_id).not_to eq(category.id)
|
expect(post.topic.reload.category_id).not_to eq(category.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "trying to add a link without permission" do
|
||||||
|
it "returns an error message if links are added to posts when not allowed" do
|
||||||
|
post = create_post
|
||||||
|
sign_in(post.user)
|
||||||
|
SiteSetting.post_links_allowed_groups = Group::AUTO_GROUPS[:admins]
|
||||||
|
|
||||||
|
put "/posts/#{post.id}",
|
||||||
|
params: {
|
||||||
|
post: {
|
||||||
|
raw: "I'm editing this post to add www.linkhere.com",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(response.status).to eq(422)
|
||||||
|
expect(response.body).to include("Sorry, you can't include links in your posts.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "with Post.plugin_permitted_update_params" do
|
describe "with Post.plugin_permitted_update_params" do
|
||||||
before do
|
before do
|
||||||
plugin = Plugin::Instance.new
|
plugin = Plugin::Instance.new
|
||||||
|
Loading…
x
Reference in New Issue
Block a user