fix: return auth none when no auth is configured for smtp + scopes in grpc response (#11554)

# Which Problems Are Solved

- When no auth was present on a smtp configuration, the `auth` field was
`nil` on the response while it should be `none`.
- Scopes were not properly retrieved from the database resulting in all
scopes being combined in one scope when retrieving the configuration.

# How the Problems Are Solved

- Set `auth` to `none` when no auth is configured
- Use `database.TextArray[string]` as type to get the scopes from the
database

# Additional Changes

# Additional Context
This commit is contained in:
Wim Van Laer
2026-02-11 11:48:41 +01:00
committed by GitHub
parent a24e3f03b9
commit e98aa10892
3 changed files with 22 additions and 7 deletions
@@ -108,6 +108,12 @@ func smtpToPb(config *query.SMTP) *settings_pb.EmailProvider_Smtp {
ret.Smtp.Auth = xoauth2
}
if config.XOAuth2Auth == nil && config.PlainAuth == nil {
ret.Smtp.Auth = &settings_pb.EmailProviderSMTP_None{
None: &settings_pb.SMTPNoAuth{},
}
}
return ret
}
@@ -407,6 +407,19 @@ func Test_smtpToPb(t *testing.T) {
},
},
},
{
name: "no auth must map to none",
args: args{
req: &query.SMTP{},
},
res: &settings_pb.EmailProvider_Smtp{
Smtp: &settings_pb.EmailProviderSMTP{
Auth: &settings_pb.EmailProviderSMTP_None{
None: &settings_pb.SMTPNoAuth{},
},
},
},
},
{
name: "plain auth must map to plain",
args: args{