mirror of
				https://github.com/discourse/discourse-solved.git
				synced 2025-11-04 00:19:05 +00:00 
			
		
		
		
	This commit autoloads plugin files, and also extracts features into their own modules. - `plugin.rb` is smaller - external plugins like discourse-automation and discourse-assign have their own entrypoints - solved filters as well
		
			
				
	
	
		
			23 lines
		
	
	
		
			551 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			551 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
# frozen_string_literal: true
 | 
						|
 | 
						|
module DiscourseSolved::WebHookExtension
 | 
						|
  extend ActiveSupport::Concern
 | 
						|
 | 
						|
  class_methods do
 | 
						|
    def enqueue_solved_hooks(event, post, payload = nil)
 | 
						|
      if active_web_hooks(event).exists? && post.present?
 | 
						|
        payload ||= WebHook.generate_payload(:post, post)
 | 
						|
 | 
						|
        WebHook.enqueue_hooks(
 | 
						|
          :solved,
 | 
						|
          event,
 | 
						|
          id: post.id,
 | 
						|
          category_id: post.topic&.category_id,
 | 
						|
          tag_ids: post.topic&.tags&.pluck(:id),
 | 
						|
          payload: payload,
 | 
						|
        )
 | 
						|
      end
 | 
						|
    end
 | 
						|
  end
 | 
						|
end
 |