Skip to content

Commit

Permalink
Make aliases one word
Browse files Browse the repository at this point in the history
  • Loading branch information
burdiyan committed Sep 13, 2023
1 parent 396f0c0 commit bc95868
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/daemon/api/accounts/v1alpha/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"mintter/backend/hyper"
"mintter/backend/hyper/hypersql"
"mintter/backend/pkg/future"
"strings"

"crawshaw.io/sqlite"
"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -193,6 +194,14 @@ func UpdateProfile(ctx context.Context, me core.Identity, blobs *hyper.Storage,

patch := map[string]any{}

if in.Alias != "" {
parts := strings.Fields(in.Alias)
if len(parts) != 1 {
return fmt.Errorf("alias must be a single word: got = %q", in.Alias)
}
in.Alias = parts[0]
}

v, ok := e.Get("alias")
if (ok && v.(string) != in.Alias) || (!ok && in.Alias != "") {
patch["alias"] = in.Alias
Expand Down

0 comments on commit bc95868

Please sign in to comment.