From cfa85f92e2eba34f486c2b8b5f48eb8b868b7076 Mon Sep 17 00:00:00 2001 From: Alex Yocom-Piatt Date: Tue, 6 Sep 2022 15:58:38 -0400 Subject: [PATCH] add replace to token inventory --- politeiawww/cmswww.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/politeiawww/cmswww.go b/politeiawww/cmswww.go index 0702948b4..f1735d33e 100644 --- a/politeiawww/cmswww.go +++ b/politeiawww/cmswww.go @@ -1080,6 +1080,16 @@ func (p *politeiawww) handlePassThroughTokenInventory(w http.ResponseWriter, r * return } + oldTokens := tir1.Approved + for i, token := range oldTokens { + log.Infof("inventory checking token, %s", token) + if newToken, ok := tlogTokens[token]; ok { + log.Infof("inventory found token, %s replacing with %s", token, newToken) + oldTokens[i] = newToken + } + } + tir1.Approved = oldTokens + reply, err := json.Marshal(tir1) if err != nil { RespondWithError(w, r, 0, "handlePassThroughTokenInventory: marshal both reply", @@ -1104,6 +1114,7 @@ func (p *politeiawww) handlePassThroughBatchProposals(w http.ResponseWriter, r * }) return } + oldTokens := bp.Tokens for i, token := range oldTokens { log.Infof("checking token, %s", token)