mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user