Skip to content

Commit

Permalink
simplify getProposalType func to fix lint error
Browse files Browse the repository at this point in the history
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
  • Loading branch information
ukane-philemon committed Dec 8, 2023
1 parent ec05b37 commit bc56543
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions libwallet/internal/politeia/politeia_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,27 @@ func (c *politeiaClient) batchProposals(tokens []string) ([]Proposal, error) {
}

func getProposalType(payload string) ProposalType {
prop := ProposalTypeNormal
decodedBytes, err := base64.StdEncoding.DecodeString(payload)
if err != nil {
fmt.Println("error decoding proposalmetadata:", err)
return ProposalTypeNormal
fmt.Println("error decoding proposal metadata:", err)
return prop
}

var meta metadataProposal
err = json.Unmarshal(decodedBytes, &meta)
if err != nil {
if err == nil {
log.Error("error unmarshalling metadataProposal:", err)
return prop
}

if meta.LinkTo != "" {
return ProposalTypeRFPSubmission
prop = ProposalTypeRFPSubmission
} else if meta.LinkBy != 0 {
return ProposalTypeRFPProposal
} else {
return ProposalTypeNormal
prop = ProposalTypeRFPProposal
}

return prop
}

func (c *politeiaClient) proposalDetails(token string) (*www.ProposalDetailsReply, error) {
Expand Down
4 changes: 2 additions & 2 deletions ui/page/components/bottom_nav.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ type BottomNavigationBarHandler struct {
type BottomNavigationBar struct {
*load.Load

FloatingActionButton []BottomNavigationBarHandler
FloatingActionButton []BottomNavigationBarHandler
BottomNavigationItems []BottomNavigationBarHandler
CurrentPage string
CurrentPage string

axis layout.Axis
textSize unit.Sp
Expand Down

0 comments on commit bc56543

Please sign in to comment.