Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notification services logs error when user has no email address #6855

Closed
wkloucek opened this issue Jul 20, 2023 · 0 comments · Fixed by #6863
Closed

notification services logs error when user has no email address #6855

wkloucek opened this issue Jul 20, 2023 · 0 comments · Fixed by #6863
Assignees
Labels

Comments

@wkloucek
Copy link
Contributor

Describe the bug

The notification service logs an error when the user has no email address specified

Steps to reproduce

Steps to reproduce the behavior:

  1. have the notification service up and running / configure to send emails
  2. share something with a user that has no email address

Expected behavior

See no error log in the notifications service

Actual behavior

The notifications service logs {"level":"error","service":"notifications","error":"Mail Error: No recipient specified","event":"SendEmail","time":"2023-07-20T08:02:40.951025544Z","line":"github.com/owncloud/ocis/v2/services/notifications/pkg/service/service.go:124","message":"failed to send a message"}

This should be a "info" or better "debug" level log statement, because this is not an error.

Ideally we're checking first (before doing anything else) if:

  • the user has an email address
  • the user want's to receive emails

This prevents wasting CPU / Memory

The second point is already checked here and this could be extended for the email address!?:

func (s eventsNotifier) disableEmails(ctx context.Context, u *user.UserId) bool {
granteeCtx := metadata.Set(ctx, middleware.AccountID, u.OpaqueId)
if resp, err := s.valueService.GetValueByUniqueIdentifiers(granteeCtx,
&settingssvc.GetValueByUniqueIdentifiersRequest{
AccountUuid: u.OpaqueId,
SettingId: defaults.SettingUUIDProfileDisableNotifications,
},
); err == nil {
return resp.GetValue().GetValue().GetBoolValue()
}
return false
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants