Fix some bugs

This commit is contained in:
mcrakhman 2022-07-06 23:35:43 +02:00 committed by Mikhail Iudin
parent 2940519b5f
commit f15c806415
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
4 changed files with 18 additions and 7 deletions

View File

@ -120,3 +120,4 @@ graph:
maybeHeads: maybeHeads:
- A.1.3 - A.1.3
- B.1.2 - B.1.2

View File

@ -25,11 +25,13 @@ type Keychain struct {
func NewKeychain() *Keychain { func NewKeychain() *Keychain {
return &Keychain{ return &Keychain{
SigningKeys: map[string]threadmodels.SigningPrivKey{}, SigningKeys: map[string]threadmodels.SigningPrivKey{},
EncryptionKeys: map[string]threadmodels.EncryptionPrivKey{}, SigningKeysByIdentity: map[string]threadmodels.SigningPrivKey{},
GeneratedIdentities: map[string]string{}, EncryptionKeys: map[string]threadmodels.EncryptionPrivKey{},
ReadKeys: map[string]*SymKey{}, GeneratedIdentities: map[string]string{},
coder: threadmodels.NewEd25519Decoder(), ReadKeys: map[string]*SymKey{},
ReadKeysByHash: map[uint64]*SymKey{},
coder: threadmodels.NewEd25519Decoder(),
} }
} }

View File

@ -9,6 +9,8 @@ package threadbuilder
import ( import (
"fmt" "fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/data/pb"
"github.com/gogo/protobuf/proto"
"strings" "strings"
"unicode" "unicode"
@ -42,7 +44,13 @@ func (t *ThreadBuilder) Graph() (string, error) {
var chSymbs []string var chSymbs []string
if r.changesDataDecrypted != nil { if r.changesDataDecrypted != nil {
for _, chc := range r.changesDataDecrypted.Content { res := &pb.PlainTextChangeData{}
err := proto.Unmarshal(r.changesDataDecrypted, res)
if err != nil {
return err
}
for _, chc := range res.Content {
tp := fmt.Sprintf("%T", chc.Value) tp := fmt.Sprintf("%T", chc.Value)
tp = strings.Replace(tp, "ChangeContentValueOf", "", 1) tp = strings.Replace(tp, "ChangeContentValueOf", "", 1)
res := "" res := ""

View File

@ -44,7 +44,7 @@ func (tb *TreeBuilder) Init() {
} }
func (tb *TreeBuilder) Build(fromStart bool) (*Tree, error) { func (tb *TreeBuilder) Build(fromStart bool) (*Tree, error) {
heads := tb.thread.Heads() heads := tb.thread.MaybeHeads()
if fromStart { if fromStart {
if err := tb.buildTreeFromStart(heads); err != nil { if err := tb.buildTreeFromStart(heads); err != nil {