From af2299f417d40c5957095f0ca902afe965e6dae5 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 2 Apr 2026 15:25:51 +0000 Subject: [PATCH] Fix saving of tags on users --- platform/user.go | 6 ++++-- resource/user.go | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/platform/user.go b/platform/user.go index 96e5e7f8..98461454 100644 --- a/platform/user.go +++ b/platform/user.go @@ -30,11 +30,12 @@ type User struct { DisplayName string ID int Initials string + IsDronePilot bool + IsWarrant bool Organization Organization PasswordHash string PasswordHashType string Role string - Tags []string Username string model *models.User @@ -61,11 +62,12 @@ func newUser(ctx context.Context, org Organization, user *models.User) User { DisplayName: user.DisplayName, ID: int(user.ID), Initials: extractInitials(user.DisplayName), + IsDronePilot: user.IsDronePilot, + IsWarrant: user.IsWarrant, Organization: org, PasswordHash: user.PasswordHash, PasswordHashType: string(user.PasswordHashType), Role: user.Role.String(), - Tags: []string{}, Username: user.Username, model: user, diff --git a/resource/user.go b/resource/user.go index 24d5e7b5..714e23f3 100644 --- a/resource/user.go +++ b/resource/user.go @@ -48,6 +48,13 @@ func (res *userR) response(u *platform.User) (*user, error) { if err != nil { return nil, fmt.Errorf("id to uri: %w", err) } + tags := make([]string, 0) + if u.IsDronePilot { + tags = append(tags, "drone pilot") + } + if u.IsWarrant { + tags = append(tags, "warrant") + } return &user{ Avatar: omitnull.FromPtr(avatar), DisplayName: omit.From(u.DisplayName), @@ -55,7 +62,7 @@ func (res *userR) response(u *platform.User) (*user, error) { Initials: omit.From(u.Initials), IsActive: omit.From(u.Active), Role: omit.From(u.Role), - Tags: omit.From(u.Tags), + Tags: omit.From(tags), URI: omit.From(uri), Username: omit.From(u.Username), }, nil