diff options
Diffstat (limited to 'cmd/mirum-server/server_admin.go')
| -rw-r--r-- | cmd/mirum-server/server_admin.go | 27 | +3 −24 |
1 files changed, 3 insertions, 24 deletions
diff --git a/cmd/mirum-server/server_admin.go b/cmd/mirum-server/server_admin.go index 14f499f..a79c377 100644 --- a/cmd/mirum-server/server_admin.go +++ b/cmd/mirum-server/server_admin.go @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2026 Nikolay Govorov +// Copyright (c) 2026 Nikolay Govorov // SPDX-License-Identifier: AGPL-3.0-or-later package main @@ -60,8 +60,6 @@ var errSpecs = []struct { {ErrSoleOwner, connect.CodeFailedPrecondition, apipb.ErrorReason_ERROR_REASON_SOLE_OWNER}, {ErrInvalidSlug, connect.CodeInvalidArgument, apipb.ErrorReason_ERROR_REASON_INVALID_SLUG}, {ErrInvalidRole, connect.CodeInvalidArgument, apipb.ErrorReason_ERROR_REASON_INVALID_ROLE}, - {ErrInvalidDateFormat, connect.CodeInvalidArgument, apipb.ErrorReason_ERROR_REASON_INVALID_DATE_FORMAT}, - {ErrInvalidTimezone, connect.CodeInvalidArgument, apipb.ErrorReason_ERROR_REASON_INVALID_TIMEZONE}, {ErrReservedEmail, connect.CodeInvalidArgument, apipb.ErrorReason_ERROR_REASON_RESERVED_EMAIL}, {ErrPermissionDenied, connect.CodePermissionDenied, apipb.ErrorReason_ERROR_REASON_PERMISSION_DENIED}, {ErrUnauthenticated, connect.CodeUnauthenticated, apipb.ErrorReason_ERROR_REASON_UNAUTHENTICATED}, @@ -163,16 +161,9 @@ func pageResponse[K IDKind](items int, limit int, lastID ID[K], total int) *apip // --- Proto converters --- func userToProto(u User) *apipb.User { - pb := &apipb.User{ + return &apipb.User{ Id: u.ID.Bytes(), Email: u.Email, CreatedAt: timestamppb.New(u.CreatedAt), - Timezone: u.Timezone, } - pb.Locale = &apipb.Locale{Language: u.Locale.Language} - if u.Locale.DateFormat != nil { - df := apipb.DateFormat(*u.Locale.DateFormat) - pb.Locale.DateFormat = &df - } - return pb } func orgToProto(o Organization) *apipb.Org { @@ -257,19 +248,7 @@ func (a *consoleService) UserUpdate(ctx context.Context, req *connect.Request[ap if err != nil { return nil, mapErr(err) } - p := UserUpdateParams{ - Email: req.Msg.Email, - Password: req.Msg.Password, - Timezone: req.Msg.Timezone, - } - if req.Msg.Locale != nil { - p.Locale = &Locale{Language: req.Msg.Locale.Language} - if req.Msg.Locale.DateFormat != nil { - df := DateFormat(*req.Msg.Locale.DateFormat) - p.Locale.DateFormat = &df - } - } - if err := a.srv.db.UserUpdate(ctx, ActorFromContext(ctx), ref, p, []byte(a.srv.cfg.Pepper)); err != nil { + if err := a.srv.db.UserUpdate(ctx, ActorFromContext(ctx), ref, req.Msg.Email, req.Msg.Password, []byte(a.srv.cfg.Pepper)); err != nil { return nil, mapErr(err) } return connect.NewResponse(&apipb.UserUpdateResponse{}), nil |
