New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated profiles' create and edit #180
Conversation
fixed typo
fixed typo 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks overall good to me. There's only a small change I would do inside the CLI save command
x/profile/client/cli/tx.go
Outdated
picture := viper.GetString(flagProfilePic) | ||
cover := viper.GetString(flagProfileCover) | ||
moniker := viper.GetString(flagMoniker) | ||
name := viper.GetString(flagName) | ||
surname := viper.GetString(flagSurname) | ||
bio := viper.GetString(flagBio) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if using get GetString
having an empty string works as we would want to. What I was thinking is the following.
Suppose you execute desmoscli tx save --name="Riccardo"
then what will happen is that all the remaining fields are rest to ""
instead of nil
(I've checked and they are two different values). So I think we should change it appropriately.
This could be done by creating the following functions:
// getOrNil returns a pointer to the given value if it is not empty. Otherwise it returns nil
func getOrNil(value string) *string {
if len(strings.TrimSpace(value)) == 0 {
return nil
}
return &value
}
And use such function as
moniker := getOrNil(viper.GetString(flagMoniker))
name := getOrNil(viper.GetString(flagMoniker))
renamed rest handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-reviewed
Codecov Report
@@ Coverage Diff @@
## master #180 +/- ##
==========================================
- Coverage 83.12% 82.68% -0.44%
==========================================
Files 58 58
Lines 2447 2374 -73
==========================================
- Hits 2034 1963 -71
+ Misses 356 355 -1
+ Partials 57 56 -1 |
Description
This PR merge the current
MsgCreateProfile
andMsgEditProfile
into the newMsgSaveProfile
that handles both the situations.Closes #170 .
Checklist
CHANGELOG.md
file.Files changed
in the Github PR explorer.