Skip to content

Commit

Permalink
Fix user id column case (#29863) (#29867)
Browse files Browse the repository at this point in the history
Backport #29863 by @lng2020

Sometimes the column name is case-sensitive and it may cause 500.

Co-authored-by: Nanguan Lin <nanguanlin6@gmail.com>
  • Loading branch information
GiteaBot and lng2020 authored Mar 17, 2024
1 parent 85f31eb commit c044510
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/user/email_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func SearchEmails(ctx context.Context, opts *SearchEmailOptions) ([]*SearchEmail
cond = cond.And(builder.Eq{"email_address.is_activated": false})
}

count, err := db.GetEngine(ctx).Join("INNER", "`user`", "`user`.ID = email_address.uid").
count, err := db.GetEngine(ctx).Join("INNER", "`user`", "`user`.id = email_address.uid").
Where(cond).Count(new(EmailAddress))
if err != nil {
return nil, 0, fmt.Errorf("Count: %w", err)
Expand All @@ -507,7 +507,7 @@ func SearchEmails(ctx context.Context, opts *SearchEmailOptions) ([]*SearchEmail
emails := make([]*SearchEmailResult, 0, opts.PageSize)
err = db.GetEngine(ctx).Table("email_address").
Select("email_address.*, `user`.name, `user`.full_name").
Join("INNER", "`user`", "`user`.ID = email_address.uid").
Join("INNER", "`user`", "`user`.id = email_address.uid").
Where(cond).
OrderBy(orderby).
Limit(opts.PageSize, (opts.Page-1)*opts.PageSize).
Expand Down

0 comments on commit c044510

Please sign in to comment.