Skip to content

Commit

Permalink
fix: Forward messages
Browse files Browse the repository at this point in the history
  • Loading branch information
loyldg committed Jan 3, 2025
1 parent 0750d83 commit e976165
Showing 1 changed file with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,34 @@ await PushUpdatesToPeerAsync(item.OwnerPeer,
}
}

private Task HandleForwardMessageAsync(ReceiveInboxMessageCompletedSagaEvent aggregateEvent)
private async Task HandleForwardMessageAsync(ReceiveInboxMessageCompletedSagaEvent aggregateEvent)
{
var item = aggregateEvent.MessageItem;

var updates = updatesLayeredService.Converter.ToInboxForwardMessageUpdates(aggregateEvent);
var layeredData = updatesLayeredService.GetLayeredData(c => c.ToInboxForwardMessageUpdates(aggregateEvent));
return PushUpdatesToPeerAsync(item.OwnerPeer,
if (aggregateEvent.MessageItem.FwdHeader?.FromId.PeerType == PeerType.Channel)
{
if (updates is TUpdates tUpdates)
{
var channelId = aggregateEvent.MessageItem.FwdHeader.FromId.PeerId;
var channelReadModel = await channelAppService.GetAsync(channelId);
var photoReadModel = channelReadModel.PhotoId.HasValue
? await photoAppService.GetAsync(channelReadModel.PhotoId.Value)
: null;

var channel = chatLayeredService.Converter.ToChannel(
0,
channelReadModel,
photoReadModel,
null,
false);
tUpdates.Chats.Add(channel);
}
}

await PushUpdatesToPeerAsync(item.OwnerPeer,
updates,
pts: item.Pts,
layeredData: layeredData);
pts: item.Pts);
}

private async Task HandleInviteToChannelAsync(SendOutboxMessageCompletedSagaEvent aggregateEvent)
Expand Down

0 comments on commit e976165

Please sign in to comment.