forked from tangled.org/core
this repo has no description

rework comment lexicon to add reply_to

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li d7569292 11713b90

verified
Changed files
+26 -84
api
lexicons
issue
+16 -73
api/tangled/cbor_gen.go
···
}
cw := cbg.NewCborWriter(w)
-
fieldCount := 6
-
-
if t.Owner == nil {
-
fieldCount--
-
}
-
if t.Repo == nil {
fieldCount--
}
···
return err
}
-
// t.Repo (string) (string)
-
if t.Repo != nil {
-
-
if len("repo") > 1000000 {
-
return xerrors.Errorf("Value in field \"repo\" was too long")
-
}
-
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string("repo")); err != nil {
-
return err
-
}
-
-
if t.Repo == nil {
-
if _, err := cw.Write(cbg.CborNull); err != nil {
-
return err
-
}
-
} else {
-
if len(*t.Repo) > 1000000 {
-
return xerrors.Errorf("Value in field t.Repo was too long")
-
}
-
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
-
return err
-
}
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
-
return err
-
}
-
}
-
}
-
// t.LexiconTypeID (string) (string)
if len("$type") > 1000000 {
return xerrors.Errorf("Value in field \"$type\" was too long")
···
return err
}
-
// t.Owner (string) (string)
-
if t.Owner != nil {
-
if len("owner") > 1000000 {
-
return xerrors.Errorf("Value in field \"owner\" was too long")
}
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
return err
}
-
if _, err := cw.WriteString(string("owner")); err != nil {
return err
}
-
if t.Owner == nil {
if _, err := cw.Write(cbg.CborNull); err != nil {
return err
}
} else {
-
if len(*t.Owner) > 1000000 {
-
return xerrors.Errorf("Value in field t.Owner was too long")
}
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil {
return err
}
-
if _, err := cw.WriteString(string(*t.Owner)); err != nil {
return err
}
}
···
t.Body = string(sval)
}
-
// t.Repo (string) (string)
-
case "repo":
-
-
{
-
b, err := cr.ReadByte()
-
if err != nil {
-
return err
-
}
-
if b != cbg.CborNull[0] {
-
if err := cr.UnreadByte(); err != nil {
-
return err
-
}
-
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
-
if err != nil {
-
return err
-
}
-
-
t.Repo = (*string)(&sval)
-
}
-
}
// t.LexiconTypeID (string) (string)
case "$type":
···
t.Issue = string(sval)
}
-
// t.Owner (string) (string)
-
case "owner":
{
b, err := cr.ReadByte()
···
return err
}
-
t.Owner = (*string)(&sval)
}
}
// t.CreatedAt (string) (string)
···
}
cw := cbg.NewCborWriter(w)
+
fieldCount := 5
+
if t.ReplyTo == nil {
fieldCount--
}
···
return err
}
// t.LexiconTypeID (string) (string)
if len("$type") > 1000000 {
return xerrors.Errorf("Value in field \"$type\" was too long")
···
return err
}
+
// t.ReplyTo (string) (string)
+
if t.ReplyTo != nil {
+
if len("replyTo") > 1000000 {
+
return xerrors.Errorf("Value in field \"replyTo\" was too long")
}
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("replyTo"))); err != nil {
return err
}
+
if _, err := cw.WriteString(string("replyTo")); err != nil {
return err
}
+
if t.ReplyTo == nil {
if _, err := cw.Write(cbg.CborNull); err != nil {
return err
}
} else {
+
if len(*t.ReplyTo) > 1000000 {
+
return xerrors.Errorf("Value in field t.ReplyTo was too long")
}
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.ReplyTo))); err != nil {
return err
}
+
if _, err := cw.WriteString(string(*t.ReplyTo)); err != nil {
return err
}
}
···
t.Body = string(sval)
}
// t.LexiconTypeID (string) (string)
case "$type":
···
t.Issue = string(sval)
}
+
// t.ReplyTo (string) (string)
+
case "replyTo":
{
b, err := cr.ReadByte()
···
return err
}
+
t.ReplyTo = (*string)(&sval)
}
}
// t.CreatedAt (string) (string)
+1 -2
api/tangled/issuecomment.go
···
Body string `json:"body" cborgen:"body"`
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
Issue string `json:"issue" cborgen:"issue"`
-
Owner *string `json:"owner,omitempty" cborgen:"owner,omitempty"`
-
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
}
···
Body string `json:"body" cborgen:"body"`
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
Issue string `json:"issue" cborgen:"issue"`
+
ReplyTo *string `json:"replyTo,omitempty" cborgen:"replyTo,omitempty"`
}
+9 -9
lexicons/issue/comment.json
···
"key": "tid",
"record": {
"type": "object",
-
"required": ["issue", "body", "createdAt"],
"properties": {
"issue": {
"type": "string",
"format": "at-uri"
},
-
"repo": {
-
"type": "string",
-
"format": "at-uri"
-
},
-
"owner": {
-
"type": "string",
-
"format": "did"
-
},
"body": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "datetime"
}
}
}
···
"key": "tid",
"record": {
"type": "object",
+
"required": [
+
"issue",
+
"body",
+
"createdAt"
+
],
"properties": {
"issue": {
"type": "string",
"format": "at-uri"
},
"body": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "datetime"
+
},
+
"replyTo": {
+
"type": "string",
+
"format": "at-uri"
}
}
}