Skip to content

Commit

Permalink
fix prop
Browse files Browse the repository at this point in the history
  • Loading branch information
leohhhn committed Feb 12, 2025
1 parent 6479e4d commit 45da2de
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions examples/gno.land/r/gnoland/users/v1/admin.gno
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ func NewSetPausedExecutor(newPausedValue bool) dao.Executor {
// The associated address and all previous names of a user that changes a name
// are preserved, and all resolve to the new name.
func ProposeNewName(addr std.Address, newName string) dao.Executor {
cb := func() error {
if matched := reUsername.MatchString(newName); !matched {
return ErrInvalidUsername
}
if matched := reUsername.MatchString(newName); !matched {
panic(ErrInvalidUsername)
}

userData := susers.ResolveAddress(addr)
if userData == nil {
panic(ErrInvalidUsername)
}

userData := susers.ResolveAddress(addr)
cb := func() error {
if err := userData.UpdateName(newName); err != nil {
return err
}

return nil
}

Expand All @@ -45,12 +48,15 @@ func ProposeNewName(addr std.Address, newName string) dao.Executor {
// This will make the associated address and names unresolvable.
// WARN: After deletion, the same address WILL NOT be able to register a new name.
func ProposeDeleteUser(addr std.Address) dao.Executor {
userData := susers.ResolveAddress(addr)
if userData == nil {
panic(ErrInvalidUsername)
}

cb := func() error {
userData := susers.ResolveAddress(addr)
if err := userData.Delete(); err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit 45da2de

Please sign in to comment.