fix: stabilize me subscription sync metadata
This commit is contained in:
@@ -3301,6 +3301,7 @@ func (a *adapter) TopicsForUser(uid t.Uid, keepDeleted bool, opts *t.QueryOpt) (
|
||||
limit = a.maxResults
|
||||
}
|
||||
|
||||
q += " ORDER BY topic ASC, deletedat IS NULL DESC, updatedat DESC, id DESC"
|
||||
if limit > 0 {
|
||||
q += " LIMIT ?"
|
||||
args = append(args, limit)
|
||||
@@ -3329,7 +3330,12 @@ func (a *adapter) TopicsForUser(uid t.Uid, keepDeleted bool, opts *t.QueryOpt) (
|
||||
}
|
||||
tname := sub.Topic
|
||||
sub.User = uid.String()
|
||||
if !t.ParseUserId(tname).IsZero() {
|
||||
// Legacy self-user subscriptions are not conversation entries.
|
||||
continue
|
||||
}
|
||||
tcat := t.GetTopicCat(tname)
|
||||
peerID := ""
|
||||
|
||||
if tcat == t.TopicCatMe || tcat == t.TopicCatFnd {
|
||||
// One of 'me', 'fnd' subscriptions, skip.
|
||||
@@ -3341,19 +3347,27 @@ func (a *adapter) TopicsForUser(uid t.Uid, keepDeleted bool, opts *t.QueryOpt) (
|
||||
p2pResolved[tname] = false
|
||||
if uid1 == uid {
|
||||
usrq = append(usrq, store.DecodeUid(uid2))
|
||||
sub.SetWith(uid2.UserId())
|
||||
peerID = uid2.UserId()
|
||||
sub.SetWith(peerID)
|
||||
} else {
|
||||
usrq = append(usrq, store.DecodeUid(uid1))
|
||||
sub.SetWith(uid1.UserId())
|
||||
peerID = uid1.UserId()
|
||||
sub.SetWith(peerID)
|
||||
}
|
||||
} else if tcat == t.TopicCatGrp {
|
||||
// Maybe convert channel name to group topic name.
|
||||
tname = t.ChnToGrp(tname)
|
||||
}
|
||||
if _, exists := join[tname]; exists {
|
||||
continue
|
||||
}
|
||||
// No special handling needed for 'slf', 'sys' subscriptions.
|
||||
|
||||
topq = append(topq, tname)
|
||||
sub.Private = common.FromJSON(sub.Private)
|
||||
if tcat == t.TopicCatP2P {
|
||||
sub.Private = ensureP2PPrivatePeer(sub.Private, peerID)
|
||||
}
|
||||
join[tname] = sub
|
||||
}
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user