feat: Show re-auth flag only for legacy Gmail and OAuth channels (#10189)

This commit is contained in:
Shivam Mishra
2024-10-02 13:21:02 +05:30
committed by GitHub
parent 42f6621afb
commit fce4d5e26e
2 changed files with 8 additions and 2 deletions

View File

@@ -61,6 +61,10 @@ class Channel::Email < ApplicationRecord
provider == 'google'
end
def legacy_google?
imap_enabled && imap_address == 'imap.gmail.com'
end
private
def ensure_forward_to_email

View File

@@ -72,8 +72,10 @@ if resource.email?
json.imap_port resource.channel.try(:imap_port)
json.imap_enabled resource.channel.try(:imap_enabled)
json.imap_enable_ssl resource.channel.try(:imap_enable_ssl)
# show this even for regular imap channels, to allow transitioning to OAuth
json.reauthorization_required resource.channel.try(:provider_config).empty? || resource.channel.try(:reauthorization_required?)
if resource.channel.try(:microsoft?) || resource.channel.try(:google?) || resource.channel.try(:legacy_google?)
json.reauthorization_required resource.channel.try(:provider_config).empty? || resource.channel.try(:reauthorization_required?)
end
end
## SMTP