feat: sync bot keyboards and callbacks
Sync telesrv b96f2dd (feat(bot): complete keyboards callbacks and durable delivery). Skipped private docs and preserved public README files per sync rules; normalized the appearance seed log label for public naming.
This commit is contained in:
parent
0c99ae0a9d
commit
bf965f610c
80 changed files with 7212 additions and 349 deletions
|
|
@ -35,6 +35,33 @@ func (s *MessageStore) GetByIDs(_ context.Context, userID int64, ids []int) (dom
|
|||
return out, nil
|
||||
}
|
||||
|
||||
// GetByUID resolves one owner's box row by the shared private message id. Callback delivery
|
||||
// uses it to translate the clicker's box id to the bot's box id without scanning history.
|
||||
func (s *MessageStore) GetByUID(_ context.Context, userID, uid int64) (domain.Message, bool, error) {
|
||||
if userID == 0 || uid == 0 {
|
||||
return domain.Message{}, false, nil
|
||||
}
|
||||
s.mu.RLock()
|
||||
var found domain.Message
|
||||
for _, msg := range s.m[userID] {
|
||||
if msg.UID == uid {
|
||||
found = cloneMessage(msg)
|
||||
reactions := s.privateMessageReactionsForMessageLocked(found)
|
||||
if len(reactions.Results) > 0 || len(reactions.Recent) > 0 {
|
||||
found.Reactions = cloneChannelMessageReactionsPtr(&reactions)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
s.mu.RUnlock()
|
||||
if found.ID == 0 {
|
||||
return domain.Message{}, false, nil
|
||||
}
|
||||
items := []domain.Message{found}
|
||||
s.enrichPrivateMessagePolls(items, int(time.Now().Unix()))
|
||||
return items[0], true, nil
|
||||
}
|
||||
|
||||
func (s *MessageStore) ListByUser(_ context.Context, userID int64, filter domain.MessageFilter) (domain.MessageList, error) {
|
||||
s.mu.RLock()
|
||||
messages := cloneMessages(s.m[userID])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue