0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-13 00:16:07 +02:00

use GetUserIDsByNames for mention lookups

This commit is contained in:
yuvrajangadsingh 2026-03-15 01:42:08 +05:30
parent 0084880f6a
commit 23ca3422dd
No known key found for this signature in database

View File

@ -130,10 +130,14 @@ func CreateCommitCommentNotification(ctx context.Context, doer *user_model.User,
}
// Notify @mentioned users
for _, username := range mentionedUsernames {
mentioned, err := user_model.GetUserByName(ctx, username)
if err == nil && mentioned.ID != doer.ID {
receiverIDs[mentioned.ID] = struct{}{}
if len(mentionedUsernames) > 0 {
mentionedIDs, err := user_model.GetUserIDsByNames(ctx, mentionedUsernames, true)
if err == nil {
for _, id := range mentionedIDs {
if id != doer.ID {
receiverIDs[id] = struct{}{}
}
}
}
}