refactor(email): tighten inbox setup flow

This commit is contained in:
Sojan Jose
2026-05-31 14:01:03 +05:30
parent 8ac5af649a
commit 6c2aed2f40
4 changed files with 279 additions and 270 deletions
@@ -41,7 +41,7 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
name: inbox_name(channel),
channel: channel
}.merge(
permitted_params.except(:channel)
permitted_params.except(:channel, :imap_fetch_interval)
)
)
@inbox.save!
@@ -192,7 +192,7 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
def permitted_params(channel_attributes = [])
# We will remove this line after fixing https://linear.app/chatwoot/issue/CW-1567/null-value-passed-as-null-string-to-backend
params.each { |k, v| params[k] = params[k] == 'null' ? nil : v }
params.permit(*inbox_attributes, channel: [:type, *channel_attributes])
params.permit(:imap_fetch_interval, *inbox_attributes, channel: [:type, *channel_attributes])
end
def channel_type_from_params