mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	 4c43330b15
			
		
	
	4c43330b15
	
	
	
		
			
			This change targets the public API and is related to the Inbox with channel type API.
Exposes public inbox details under /public/api/v1/inboxes/{inbox_identifier}. This allows access to feature flags and business hours configured for the inbox.
ref: #5514
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			767 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			767 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| class Public::Api::V1::InboxesController < PublicController
 | |
|   before_action :set_inbox_channel
 | |
|   before_action :set_contact_inbox
 | |
|   before_action :set_conversation
 | |
| 
 | |
|   def show
 | |
|     @inbox_channel = ::Channel::Api.find_by!(identifier: params[:id])
 | |
|   end
 | |
| 
 | |
|   private
 | |
| 
 | |
|   def set_inbox_channel
 | |
|     return if params[:inbox_id].blank?
 | |
| 
 | |
|     @inbox_channel = ::Channel::Api.find_by!(identifier: params[:inbox_id])
 | |
|   end
 | |
| 
 | |
|   def set_contact_inbox
 | |
|     return if params[:contact_id].blank?
 | |
| 
 | |
|     @contact_inbox = @inbox_channel.inbox.contact_inboxes.find_by!(source_id: params[:contact_id])
 | |
|   end
 | |
| 
 | |
|   def set_conversation
 | |
|     return if params[:conversation_id].blank?
 | |
| 
 | |
|     @conversation = @contact_inbox.contact.conversations.find_by!(display_id: params[:conversation_id])
 | |
|   end
 | |
| end
 |