GetMailableEmailsByUsernames returns a list of verified primary email addresses (where email notifications are sent to) of users with given list of usernames. Non-existing usernames are ignored.
(ctx context.Context, usernames []string)
| 777 | // addresses (where email notifications are sent to) of users with given list of |
| 778 | // usernames. Non-existing usernames are ignored. |
| 779 | func (s *UsersStore) GetMailableEmailsByUsernames(ctx context.Context, usernames []string) ([]string, error) { |
| 780 | emails := make([]string, 0, len(usernames)) |
| 781 | return emails, s.db.WithContext(ctx). |
| 782 | Model(&User{}). |
| 783 | Select("email"). |
| 784 | Where("lower_name IN (?) AND is_active = ?", usernames, true). |
| 785 | Find(&emails).Error |
| 786 | } |
| 787 | |
| 788 | // IsUsernameUsed returns true if the given username has been used other than |
| 789 | // the excluded user (a non-positive ID effectively meaning check against all |