Allow clearing candidacy fields (closes #723)

This commit is contained in:
Christopher Goes 2018-03-28 17:08:22 +02:00 committed by rigelrozanski
parent 91d3838464
commit aa4bd05668
1 changed files with 5 additions and 13 deletions

View File

@ -126,19 +126,11 @@ func handleMsgEditCandidacy(ctx sdk.Context, msg MsgEditCandidacy, k Keeper) sdk
}
// XXX move to types
//check and edit any of the editable terms
if msg.Description.Moniker != "" {
candidate.Description.Moniker = msg.Description.Moniker
}
if msg.Description.Identity != "" {
candidate.Description.Identity = msg.Description.Identity
}
if msg.Description.Website != "" {
candidate.Description.Website = msg.Description.Website
}
if msg.Description.Details != "" {
candidate.Description.Details = msg.Description.Details
}
// replace all editable fields (clients should autofill existing values)
candidate.Description.Moniker = msg.Description.Moniker
candidate.Description.Identity = msg.Description.Identity
candidate.Description.Website = msg.Description.Website
candidate.Description.Details = msg.Description.Details
k.setCandidate(ctx, candidate)
return sdk.Result{}