From cbb86f9bf6a4b942843f5b373813f36b4f3d98a8 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Fri, 4 Sep 2015 11:35:25 +0800 Subject: [PATCH] FEATURE: Add a trigger for plugins to include their own jobs. --- app/models/post.rb | 1 + spec/components/post_creator_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/models/post.rb b/app/models/post.rb index 940cb17cf10..3a6a8d51591 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -498,6 +498,7 @@ class Post < ActiveRecord::Base args[:image_sizes] = image_sizes if image_sizes.present? args[:invalidate_oneboxes] = true if invalidate_oneboxes.present? Jobs.enqueue(:process_post, args) + DiscourseEvent.trigger(:after_trigger_post_process, self) end def self.public_posts_count_per_day(start_date, end_date, category_id=nil) diff --git a/spec/components/post_creator_spec.rb b/spec/components/post_creator_spec.rb index 955663e4d25..0595a66e007 100644 --- a/spec/components/post_creator_spec.rb +++ b/spec/components/post_creator_spec.rb @@ -75,6 +75,7 @@ describe PostCreator do DiscourseEvent.expects(:trigger).with(:post_created, anything, anything, user).once DiscourseEvent.expects(:trigger).with(:after_validate_topic, anything, anything).once DiscourseEvent.expects(:trigger).with(:before_create_topic, anything, anything).once + DiscourseEvent.expects(:trigger).with(:after_trigger_post_process, anything).once creator.create end