From 1e4d62e6ab9edab9110b386ac4d8e7be349b4680 Mon Sep 17 00:00:00 2001 From: luigi-borriello00 Date: Wed, 22 May 2024 00:36:45 +0200 Subject: [PATCH] fix(channel-service): fix getMessage sublist returned --- .../piperkt/services/servers/application/ChannelService.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servers-service/src/main/kotlin/piperkt/services/servers/application/ChannelService.kt b/servers-service/src/main/kotlin/piperkt/services/servers/application/ChannelService.kt index 73049fd2d..ebf715a30 100644 --- a/servers-service/src/main/kotlin/piperkt/services/servers/application/ChannelService.kt +++ b/servers-service/src/main/kotlin/piperkt/services/servers/application/ChannelService.kt @@ -138,8 +138,8 @@ open class ChannelService( return Result.success( ChannelQuery.GetMessagesFromChannelId.Response( channel.messages.subList( - request.from, - request.limit.coerceAtMost(channel.messages.size) + request.from.coerceAtMost(channel.messages.size), + (request.from + request.limit).coerceAtMost(channel.messages.size) ) ) )