Skip to content

Commit

Permalink
missing state assignment in rdb and mongo adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Apr 14, 2020
1 parent 31f0c29 commit d047cd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions server/db/mongodb/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,7 @@ func (a *adapter) TopicsForUser(uid t.Uid, keepDeleted bool, opts *t.QueryOpt) (
} else {
topq = append(topq, sub.Topic)
}
sub.Private = unmarshalBsonD(sub.Private)
join[sub.Topic] = sub
}
cur.Close(a.ctx)
Expand All @@ -1251,9 +1252,9 @@ func (a *adapter) TopicsForUser(uid t.Uid, keepDeleted bool, opts *t.QueryOpt) (
}
sub = join[top.Id]
sub.ObjHeader.MergeTimes(&top.ObjHeader)
sub.SetSeqId(top.SeqId)
sub.SetState(top.State)
sub.SetTouchedAt(top.TouchedAt)
sub.Private = unmarshalBsonD(sub.Private)
sub.SetSeqId(top.SeqId)
if t.GetTopicCat(sub.Topic) == t.TopicCatGrp {
// all done with a grp topic
sub.SetPublic(unmarshalBsonD(top.Public))
Expand Down Expand Up @@ -1286,6 +1287,7 @@ func (a *adapter) TopicsForUser(uid t.Uid, keepDeleted bool, opts *t.QueryOpt) (
uid2 := t.ParseUid(usr.Id)
if sub, ok := join[uid.P2PName(uid2)]; ok {
sub.ObjHeader.MergeTimes(&usr.ObjHeader)
sub.SetState(usr.State)
sub.SetPublic(unmarshalBsonD(usr.Public))
sub.SetWith(uid2.UserId())
sub.SetDefaultAccess(usr.Access.Auth, usr.Access.Anon)
Expand Down
4 changes: 3 additions & 1 deletion server/db/rethinkdb/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,9 @@ func (a *adapter) TopicsForUser(uid t.Uid, keepDeleted bool, opts *t.QueryOpt) (
for cursor.Next(&top) {
sub = join[top.Id]
sub.ObjHeader.MergeTimes(&top.ObjHeader)
sub.SetSeqId(top.SeqId)
sub.SetState(top.State)
sub.SetTouchedAt(top.TouchedAt)
sub.SetSeqId(top.SeqId)
if t.GetTopicCat(sub.Topic) == t.TopicCatGrp {
// all done with a grp topic
sub.SetPublic(top.Public)
Expand Down Expand Up @@ -1142,6 +1143,7 @@ func (a *adapter) TopicsForUser(uid t.Uid, keepDeleted bool, opts *t.QueryOpt) (
uid2 := t.ParseUid(usr.Id)
if sub, ok := join[uid.P2PName(uid2)]; ok {
sub.ObjHeader.MergeTimes(&usr.ObjHeader)
sub.SetState(usr.State)
sub.SetPublic(usr.Public)
sub.SetWith(uid2.UserId())
sub.SetDefaultAccess(usr.Access.Auth, usr.Access.Anon)
Expand Down

0 comments on commit d047cd6

Please sign in to comment.