tangled
alpha
login
or
join now
julien.rbrt.fr
/
tangled-core
forked from
tangled.org/core
0
fork
atom
Monorepo for Tangled — https://tangled.org
0
fork
atom
overview
issues
pulls
pipelines
lexicon: fix trailing comma in sh.tangled.actor.profile
oppi.li
10 months ago
9c2ab1a9
01316ba5
+31
-60
5 changed files
expand all
collapse all
unified
split
api
tangled
actorprofile.go
cbor_gen.go
appview
ingester.go
state
profile.go
lexicons
actor
profile.json
+1
-1
api/tangled/actorprofile.go
···
19
19
type ActorProfile struct {
20
20
LexiconTypeID string `json:"$type,const=sh.tangled.actor.profile" cborgen:"$type,const=sh.tangled.actor.profile"`
21
21
// bluesky: Include link to this account on Bluesky.
22
22
-
Bluesky *bool `json:"bluesky,omitempty" cborgen:"bluesky,omitempty"`
22
22
+
Bluesky bool `json:"bluesky" cborgen:"bluesky"`
23
23
// description: Free-form profile description text.
24
24
Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
25
25
Links []string `json:"links,omitempty" cborgen:"links,omitempty"`
+25
-53
api/tangled/cbor_gen.go
···
3398
3398
cw := cbg.NewCborWriter(w)
3399
3399
fieldCount := 7
3400
3400
3401
3401
-
if t.Bluesky == nil {
3402
3402
-
fieldCount--
3403
3403
-
}
3404
3404
-
3405
3401
if t.Description == nil {
3406
3402
fieldCount--
3407
3403
}
···
3518
3514
}
3519
3515
3520
3516
// t.Bluesky (bool) (bool)
3521
3521
-
if t.Bluesky != nil {
3517
3517
+
if len("bluesky") > 1000000 {
3518
3518
+
return xerrors.Errorf("Value in field \"bluesky\" was too long")
3519
3519
+
}
3522
3520
3523
3523
-
if len("bluesky") > 1000000 {
3524
3524
-
return xerrors.Errorf("Value in field \"bluesky\" was too long")
3525
3525
-
}
3521
3521
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("bluesky"))); err != nil {
3522
3522
+
return err
3523
3523
+
}
3524
3524
+
if _, err := cw.WriteString(string("bluesky")); err != nil {
3525
3525
+
return err
3526
3526
+
}
3526
3527
3527
3527
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("bluesky"))); err != nil {
3528
3528
-
return err
3529
3529
-
}
3530
3530
-
if _, err := cw.WriteString(string("bluesky")); err != nil {
3531
3531
-
return err
3532
3532
-
}
3533
3533
-
3534
3534
-
if t.Bluesky == nil {
3535
3535
-
if _, err := cw.Write(cbg.CborNull); err != nil {
3536
3536
-
return err
3537
3537
-
}
3538
3538
-
} else {
3539
3539
-
if err := cbg.WriteBool(w, *t.Bluesky); err != nil {
3540
3540
-
return err
3541
3541
-
}
3542
3542
-
}
3528
3528
+
if err := cbg.WriteBool(w, t.Bluesky); err != nil {
3529
3529
+
return err
3543
3530
}
3544
3531
3545
3532
// t.Location (string) (string)
···
3779
3766
// t.Bluesky (bool) (bool)
3780
3767
case "bluesky":
3781
3768
3782
3782
-
{
3783
3783
-
b, err := cr.ReadByte()
3784
3784
-
if err != nil {
3785
3785
-
return err
3786
3786
-
}
3787
3787
-
if b != cbg.CborNull[0] {
3788
3788
-
if err := cr.UnreadByte(); err != nil {
3789
3789
-
return err
3790
3790
-
}
3791
3791
-
3792
3792
-
maj, extra, err = cr.ReadHeader()
3793
3793
-
if err != nil {
3794
3794
-
return err
3795
3795
-
}
3796
3796
-
if maj != cbg.MajOther {
3797
3797
-
return fmt.Errorf("booleans must be major type 7")
3798
3798
-
}
3799
3799
-
3800
3800
-
var val bool
3801
3801
-
switch extra {
3802
3802
-
case 20:
3803
3803
-
val = false
3804
3804
-
case 21:
3805
3805
-
val = true
3806
3806
-
default:
3807
3807
-
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
3808
3808
-
}
3809
3809
-
t.Bluesky = &val
3810
3810
-
}
3769
3769
+
maj, extra, err = cr.ReadHeader()
3770
3770
+
if err != nil {
3771
3771
+
return err
3772
3772
+
}
3773
3773
+
if maj != cbg.MajOther {
3774
3774
+
return fmt.Errorf("booleans must be major type 7")
3775
3775
+
}
3776
3776
+
switch extra {
3777
3777
+
case 20:
3778
3778
+
t.Bluesky = false
3779
3779
+
case 21:
3780
3780
+
t.Bluesky = true
3781
3781
+
default:
3782
3782
+
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
3811
3783
}
3812
3784
// t.Location (string) (string)
3813
3785
case "location":
+1
-4
appview/ingester.go
···
210
210
description = *record.Description
211
211
}
212
212
213
213
-
includeBluesky := false
214
214
-
if record.Bluesky != nil {
215
215
-
includeBluesky = *record.Bluesky
216
216
-
}
213
213
+
includeBluesky := record.Bluesky
217
214
218
215
location := ""
219
216
if record.Location != nil {
+1
-1
appview/state/profile.go
···
325
325
Rkey: "self",
326
326
Record: &lexutil.LexiconTypeDecoder{
327
327
Val: &tangled.ActorProfile{
328
328
-
Bluesky: &profile.IncludeBluesky,
328
328
+
Bluesky: profile.IncludeBluesky,
329
329
Description: &profile.Description,
330
330
Links: profile.Links[:],
331
331
Location: &profile.Location,
+3
-1
lexicons/actor/profile.json
···
8
8
"key": "literal:self",
9
9
"record": {
10
10
"type": "object",
11
11
-
"required": ["bluesky"],
11
11
+
"required": [
12
12
+
"bluesky"
13
13
+
],
12
14
"properties": {
13
15
"description": {
14
16
"type": "string",