fix insertion of trusted from demo data

This commit is contained in:
or-else
2021-06-25 10:35:28 -07:00
parent c431101235
commit 9f8f300376
2 changed files with 17 additions and 9 deletions

View File

@ -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)
@ -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 != "" {

View File

@ -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.