fix: sync correct collectible username projection
This commit is contained in:
parent
8356989e01
commit
9041abd3d3
42 changed files with 601 additions and 758 deletions
|
|
@ -50,10 +50,11 @@ func (r *Router) onMessagesSaveDraft(ctx context.Context, req *tg.MessagesSaveDr
|
|||
if draft.TopMessageID > 0 {
|
||||
update.SetTopMsgID(draft.TopMessageID)
|
||||
}
|
||||
users, chats := r.peerObjectsForDraftUpdate(ctx, userID, peer)
|
||||
updates := &tg.Updates{
|
||||
Updates: appendAuxPtsBookkeeping([]tg.UpdateClass{update}, recorded),
|
||||
Users: r.usersForDraftUpdate(ctx, userID, peer),
|
||||
Chats: r.chatsForDraftUpdate(ctx, userID, peer),
|
||||
Users: users,
|
||||
Chats: chats,
|
||||
Date: date,
|
||||
Seq: 0,
|
||||
}
|
||||
|
|
@ -95,8 +96,7 @@ func (r *Router) onMessagesGetAllDrafts(ctx context.Context) (tg.UpdatesClass, e
|
|||
return nil, dialogDraftErr(err)
|
||||
}
|
||||
updates := make([]tg.UpdateClass, 0, len(drafts))
|
||||
users := r.usersForDrafts(ctx, userID, drafts)
|
||||
chats := r.chatsForDrafts(ctx, userID, drafts)
|
||||
users, chats := r.peerObjectsForDrafts(ctx, userID, drafts)
|
||||
for _, draft := range drafts {
|
||||
peer := tgPeer(draft.Peer)
|
||||
if peer == nil {
|
||||
|
|
@ -141,10 +141,11 @@ func (r *Router) onMessagesClearAllDrafts(ctx context.Context) (bool, error) {
|
|||
}
|
||||
}
|
||||
r.bookkeepAuxPtsForCurrentSession(ctx, events...)
|
||||
users, chats := r.peerObjectsForDrafts(ctx, userID, drafts)
|
||||
r.pushUserUpdatesIfNoReliableDispatch(ctx, userID, &tg.Updates{
|
||||
Updates: updates,
|
||||
Users: r.usersForDrafts(ctx, userID, drafts),
|
||||
Chats: r.chatsForDrafts(ctx, userID, drafts),
|
||||
Users: users,
|
||||
Chats: chats,
|
||||
Date: date,
|
||||
Seq: 0,
|
||||
})
|
||||
|
|
@ -346,6 +347,20 @@ func (r *Router) chatsForDrafts(ctx context.Context, userID int64, drafts []doma
|
|||
return chats
|
||||
}
|
||||
|
||||
func (r *Router) peerObjectsForDraftUpdate(ctx context.Context, userID int64, peer domain.Peer) ([]tg.UserClass, []tg.ChatClass) {
|
||||
users := r.usersForDraftUpdate(ctx, userID, peer)
|
||||
chats := r.chatsForDraftUpdate(ctx, userID, peer)
|
||||
r.applyUsernamesToPeerObjects(ctx, users, chats)
|
||||
return users, chats
|
||||
}
|
||||
|
||||
func (r *Router) peerObjectsForDrafts(ctx context.Context, userID int64, drafts []domain.DialogDraft) ([]tg.UserClass, []tg.ChatClass) {
|
||||
users := r.usersForDrafts(ctx, userID, drafts)
|
||||
chats := r.chatsForDrafts(ctx, userID, drafts)
|
||||
r.applyUsernamesToPeerObjects(ctx, users, chats)
|
||||
return users, chats
|
||||
}
|
||||
|
||||
func dialogDraftErr(err error) error {
|
||||
switch {
|
||||
case err == nil:
|
||||
|
|
@ -382,10 +397,11 @@ func (r *Router) clearDraftAfterSend(ctx context.Context, userID int64, peer dom
|
|||
}
|
||||
recorded := r.recordDraftMessageEvent(ctx, userID, peer, topMessageID, &date)
|
||||
r.bookkeepAuxPtsForCurrentSession(ctx, recorded)
|
||||
users, chats := r.peerObjectsForDraftUpdate(ctx, userID, peer)
|
||||
r.pushUserUpdatesIfNoReliableDispatch(ctx, userID, &tg.Updates{
|
||||
Updates: appendAuxPtsBookkeeping([]tg.UpdateClass{update}, recorded),
|
||||
Users: r.usersForDraftUpdate(ctx, userID, peer),
|
||||
Chats: r.chatsForDraftUpdate(ctx, userID, peer),
|
||||
Users: users,
|
||||
Chats: chats,
|
||||
Date: date,
|
||||
Seq: 0,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue