Audit of cde5089
This commit is contained in:
@@ -237,16 +237,12 @@ func (s *Store) EnsureUser(ctx context.Context, login, displayName string) (api.
|
||||
|
||||
func (s *Store) GetUser(ctx context.Context, login string) (api.User, error) {
|
||||
u := api.User{}
|
||||
prefs := ""
|
||||
err := s.db.QueryRowContext(ctx, `SELECT login, display_name, git_name, git_email, notification_prefs, default_model, away FROM users WHERE login = ?`, login).
|
||||
Scan(&u.Login, &u.DisplayName, &u.GitName, &u.GitEmail, &prefs, &u.DefaultModel, &u.Away)
|
||||
p := &u.NotificationPrefs
|
||||
err := s.db.QueryRowContext(ctx, `SELECT login, display_name, git_name, git_email, notify_questions, notify_reports, notify_errors, notify_rate_limits, notify_ready, notify_discard, notify_merge_problems, notify_workflows, default_model, away FROM users WHERE login = ?`, login).
|
||||
Scan(&u.Login, &u.DisplayName, &u.GitName, &u.GitEmail, &p.Questions, &p.Reports, &p.Errors, &p.RateLimits, &p.Ready, &p.Discard, &p.MergeProblems, &p.Workflows, &u.DefaultModel, &u.Away)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return u, ErrNotFound
|
||||
}
|
||||
if err != nil {
|
||||
return u, err
|
||||
}
|
||||
err = json.Unmarshal([]byte(prefs), &u.NotificationPrefs)
|
||||
return u, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user