DEV: Improve support for plugins. (#7332)

* DEV: Allow NewPostManager handlers handle PMs.
* DEV: Add custom fields topic option to PostCreator.
* DEV: Add topic_id to serializer data.
* DEV: Wrap topic title from notification item in a span.
This commit is contained in:
Dan Ungureanu
2019-05-25 16:53:03 +03:00
committed by GitHub
parent 6398ded798
commit da39d66e83
10 changed files with 29 additions and 18 deletions

View File

@@ -212,7 +212,7 @@ describe NewPostManager do
handler = -> { nil }
NewPostManager.add_handler(&handler)
expect(NewPostManager.handlers).to eq([default_handler, handler])
expect(NewPostManager.handlers).to eq([handler])
end
it "can be added in high priority" do
@@ -223,7 +223,7 @@ describe NewPostManager do
NewPostManager.add_handler(100, &a)
NewPostManager.add_handler(50, &b)
NewPostManager.add_handler(101, &c)
expect(NewPostManager.handlers).to eq([c, a, b, default_handler])
expect(NewPostManager.handlers).to eq([c, a, b])
end
end

View File

@@ -54,6 +54,11 @@ describe PostCreator do
expect { creator.create }.to raise_error(Discourse::InvalidAccess)
end
it "can be created with custom fields" do
post = PostCreator.create(user, basic_topic_params.merge(topic_opts: { custom_fields: { hello: "world" } }))
expect(post.topic.custom_fields).to eq("hello" => "world")
end
context "reply to post number" do
it "omits reply to post number if received on a new topic" do
p = PostCreator.new(user, basic_topic_params.merge(reply_to_post_number: 3)).create