MCPcopy Create free account
hub / github.com/gogs/gogs / GetMailableEmailsByUsernames

Method GetMailableEmailsByUsernames

internal/database/users.go:779–786  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

777// addresses (where email notifications are sent to) of users with given list of
778// usernames. Non-existing usernames are ignored.
779func (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

Calls 2

WhereMethod · 0.80
FindMethod · 0.65

Tested by 1