mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-30 18:47:51 +00:00 
			
		
		
		
	 92fa9c4fdc
			
		
	
	92fa9c4fdc
	
	
	
		
			
			ref: https://github.com/chatwoot/chatwoot/issues/6436 fixes: https://linear.app/chatwoot/issue/CW-1552/ability-to-rephrase-text-in-the-editor-using-gpt-integration --------- Co-authored-by: Sojan <sojan@pepalo.com> Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
		
			
				
	
	
		
			36 lines
		
	
	
		
			734 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			734 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| class Api::V1::Accounts::Integrations::HooksController < Api::V1::Accounts::BaseController
 | |
|   before_action :fetch_hook, except: [:create]
 | |
|   before_action :check_authorization
 | |
| 
 | |
|   def create
 | |
|     @hook = Current.account.hooks.create!(permitted_params)
 | |
|   end
 | |
| 
 | |
|   def update
 | |
|     @hook.update!(permitted_params.slice(:status, :settings))
 | |
|   end
 | |
| 
 | |
|   def process_event
 | |
|     render json: { message: @hook.process_event(params[:event]) }
 | |
|   end
 | |
| 
 | |
|   def destroy
 | |
|     @hook.destroy!
 | |
|     head :ok
 | |
|   end
 | |
| 
 | |
|   private
 | |
| 
 | |
|   def fetch_hook
 | |
|     @hook = Current.account.hooks.find(params[:id])
 | |
|   end
 | |
| 
 | |
|   def check_authorization
 | |
|     authorize(:hook)
 | |
|   end
 | |
| 
 | |
|   def permitted_params
 | |
|     params.require(:hook).permit(:app_id, :inbox_id, :status, settings: {})
 | |
|   end
 | |
| end
 |