Skip to content

Commit

Permalink
fix insertion of trusted from demo data
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Jun 25, 2021
1 parent c431101 commit 9f8f300
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
18 changes: 11 additions & 7 deletions tinode-db/gendb.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ func genDb(data *Data) {
Auth: types.ModeCAuth,
Anon: types.ModeNone,
},
Tags: uu.Tags,
Public: parsePublic(&uu.Public, data.datapath),
Trusted: &uu.Trusted,
Tags: uu.Tags,
Public: parsePublic(&uu.Public, data.datapath),
}
if !uu.Trusted.IsZero() {
user.Trusted = uu.Trusted
}
user.CreatedAt = getCreatedTime(uu.CreatedAt)

Expand Down Expand Up @@ -146,10 +148,12 @@ func genDb(data *Data) {
Auth: accessAuth,
Anon: accessAnon,
},
UseBt: gt.Channel,
Tags: gt.Tags,
Public: parsePublic(&gt.Public, data.datapath),
Trusted: &gt.Trusted,
UseBt: gt.Channel,
Tags: gt.Tags,
Public: parsePublic(&gt.Public, data.datapath),
}
if !gt.Trusted.IsZero() {
topic.Trusted = gt.Trusted
}
var owner types.Uid
if gt.Owner != "" {
Expand Down
8 changes: 6 additions & 2 deletions tinode-db/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ type tPrivate struct {
}

type tTrusted struct {
Verified bool `json:"verified"`
Staff bool `json:"staff"`
Verified bool `json:"verified,omitempty"`
Staff bool `json:"staff,omitempty"`
}

func (t tTrusted) IsZero() bool {
return !t.Verified && !t.Staff
}

// DefAccess is default access mode.
Expand Down

0 comments on commit 9f8f300

Please sign in to comment.