0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-04 23:10:38 +02:00

use GetUserIDsByNames for mention lookups

This commit is contained in:
yuvrajangadsingh 2026-03-15 01:42:08 +05:30
parent 31a8c3665f
commit 83bd55b2d1

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{}{}
}
}
}
}