Skip to content

Commit

Permalink
fix: fix messages.forwardMessages bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wubenqi committed Aug 28, 2023
1 parent fb4b889 commit 288194c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/bff/messages/internal/core/messages.forwardMessages_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,16 @@ func (c *MessagesCore) makeForwardMessages(
}

fwdOutboxList := make([]*msgpb.OutboxMessage, 0, int(messageList.Length()))
groupedId := int64(0)
groupedIds := make(map[int64]int64)
for _, box := range messageList.Datas {
m := box.Message
// TODO(@benqi): rid is 0

if m.GetGroupedId() != nil && groupedId == 0 {
groupedId = rand.Int63()
if m.GetGroupedId() != nil {
groupedId := groupedIds[m.GetGroupedId().GetValue()]
if _, ok := groupedIds[groupedId]; !ok {
groupedIds[groupedId] = rand.Int63()
}
}
if mtproto.IsMusicMessage(m) {
m.FwdFrom = nil
Expand Down Expand Up @@ -277,7 +280,12 @@ func (c *MessagesCore) makeForwardMessages(
m.Date = now
m.Silent = request.Silent
m.Post = false
m.GroupedId = mtproto.MakeFlagsInt64(groupedId)
if m.GetGroupedId() != nil {
groupedId := groupedIds[m.GetGroupedId().GetValue()]
m.GroupedId = mtproto.MakeFlagsInt64(groupedId)
} else {
m.GroupedId = nil
}
m.ReplyTo = nil
m.Reactions = nil

Expand Down

0 comments on commit 288194c

Please sign in to comment.