fix: add missing AccountQuotaNotifyEnabled to admin settings API
The field was present in SystemSettings response DTO and service layer but missing from: - UpdateSettingsRequest (admin handler) - saves were silently ignored - GET/PUT response mapping in admin handler - UpdateSettingsRequest (non-admin dto) This caused the toggle to always revert to off after saving.
This commit is contained in:
@@ -1 +1 @@
|
|||||||
0.1.110.23
|
0.1.110.24
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ func (h *SettingHandler) GetSettings(c *gin.Context) {
|
|||||||
WebSearchEmulationEnabled: settings.WebSearchEmulationEnabled,
|
WebSearchEmulationEnabled: settings.WebSearchEmulationEnabled,
|
||||||
BalanceLowNotifyEnabled: settings.BalanceLowNotifyEnabled,
|
BalanceLowNotifyEnabled: settings.BalanceLowNotifyEnabled,
|
||||||
BalanceLowNotifyThreshold: settings.BalanceLowNotifyThreshold,
|
BalanceLowNotifyThreshold: settings.BalanceLowNotifyThreshold,
|
||||||
|
AccountQuotaNotifyEnabled: settings.AccountQuotaNotifyEnabled,
|
||||||
AccountQuotaNotifyEmails: dto.NotifyEmailEntriesFromService(settings.AccountQuotaNotifyEmails),
|
AccountQuotaNotifyEmails: dto.NotifyEmailEntriesFromService(settings.AccountQuotaNotifyEmails),
|
||||||
PaymentEnabled: paymentCfg.Enabled,
|
PaymentEnabled: paymentCfg.Enabled,
|
||||||
PaymentMinAmount: paymentCfg.MinAmount,
|
PaymentMinAmount: paymentCfg.MinAmount,
|
||||||
@@ -311,6 +312,7 @@ type UpdateSettingsRequest struct {
|
|||||||
// Balance low notification
|
// Balance low notification
|
||||||
BalanceLowNotifyEnabled *bool `json:"balance_low_notify_enabled"`
|
BalanceLowNotifyEnabled *bool `json:"balance_low_notify_enabled"`
|
||||||
BalanceLowNotifyThreshold *float64 `json:"balance_low_notify_threshold"`
|
BalanceLowNotifyThreshold *float64 `json:"balance_low_notify_threshold"`
|
||||||
|
AccountQuotaNotifyEnabled *bool `json:"account_quota_notify_enabled"`
|
||||||
AccountQuotaNotifyEmails *[]dto.NotifyEmailEntry `json:"account_quota_notify_emails"`
|
AccountQuotaNotifyEmails *[]dto.NotifyEmailEntry `json:"account_quota_notify_emails"`
|
||||||
|
|
||||||
// Payment configuration (integrated into settings, full replace)
|
// Payment configuration (integrated into settings, full replace)
|
||||||
@@ -902,6 +904,12 @@ func (h *SettingHandler) UpdateSettings(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
return previousSettings.BalanceLowNotifyThreshold
|
return previousSettings.BalanceLowNotifyThreshold
|
||||||
}(),
|
}(),
|
||||||
|
AccountQuotaNotifyEnabled: func() bool {
|
||||||
|
if req.AccountQuotaNotifyEnabled != nil {
|
||||||
|
return *req.AccountQuotaNotifyEnabled
|
||||||
|
}
|
||||||
|
return previousSettings.AccountQuotaNotifyEnabled
|
||||||
|
}(),
|
||||||
AccountQuotaNotifyEmails: func() []service.NotifyEmailEntry {
|
AccountQuotaNotifyEmails: func() []service.NotifyEmailEntry {
|
||||||
if req.AccountQuotaNotifyEmails != nil {
|
if req.AccountQuotaNotifyEmails != nil {
|
||||||
return dto.NotifyEmailEntriesToService(*req.AccountQuotaNotifyEmails)
|
return dto.NotifyEmailEntriesToService(*req.AccountQuotaNotifyEmails)
|
||||||
@@ -1056,6 +1064,7 @@ func (h *SettingHandler) UpdateSettings(c *gin.Context) {
|
|||||||
EnableCCHSigning: updatedSettings.EnableCCHSigning,
|
EnableCCHSigning: updatedSettings.EnableCCHSigning,
|
||||||
BalanceLowNotifyEnabled: updatedSettings.BalanceLowNotifyEnabled,
|
BalanceLowNotifyEnabled: updatedSettings.BalanceLowNotifyEnabled,
|
||||||
BalanceLowNotifyThreshold: updatedSettings.BalanceLowNotifyThreshold,
|
BalanceLowNotifyThreshold: updatedSettings.BalanceLowNotifyThreshold,
|
||||||
|
AccountQuotaNotifyEnabled: updatedSettings.AccountQuotaNotifyEnabled,
|
||||||
AccountQuotaNotifyEmails: dto.NotifyEmailEntriesFromService(updatedSettings.AccountQuotaNotifyEmails),
|
AccountQuotaNotifyEmails: dto.NotifyEmailEntriesFromService(updatedSettings.AccountQuotaNotifyEmails),
|
||||||
PaymentEnabled: updatedPaymentCfg.Enabled,
|
PaymentEnabled: updatedPaymentCfg.Enabled,
|
||||||
PaymentMinAmount: updatedPaymentCfg.MinAmount,
|
PaymentMinAmount: updatedPaymentCfg.MinAmount,
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ type SystemSettings struct {
|
|||||||
// Balance low notification
|
// Balance low notification
|
||||||
BalanceLowNotifyEnabled bool `json:"balance_low_notify_enabled"`
|
BalanceLowNotifyEnabled bool `json:"balance_low_notify_enabled"`
|
||||||
BalanceLowNotifyThreshold float64 `json:"balance_low_notify_threshold"`
|
BalanceLowNotifyThreshold float64 `json:"balance_low_notify_threshold"`
|
||||||
|
AccountQuotaNotifyEnabled bool `json:"account_quota_notify_enabled"`
|
||||||
AccountQuotaNotifyEmails []NotifyEmailEntry `json:"account_quota_notify_emails"`
|
AccountQuotaNotifyEmails []NotifyEmailEntry `json:"account_quota_notify_emails"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user