From 128ef747b33aefd7ecb5b010709f6f8759c2576b Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Thu, 25 Aug 2022 11:51:53 +1000 Subject: [PATCH] tweak: only fetch and show 5 reactors for open group reactions --- SessionMessagingKit/Messages/Message.swift | 3 +++ SessionMessagingKit/Open Groups/OpenGroupAPI.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/SessionMessagingKit/Messages/Message.swift b/SessionMessagingKit/Messages/Message.swift index 9dec50347..f37f93f10 100644 --- a/SessionMessagingKit/Messages/Message.swift +++ b/SessionMessagingKit/Messages/Message.swift @@ -369,8 +369,11 @@ public extension Message { let reactors = rawReaction.reactors { let timestampMs: Int64 = Int64(floor((Date().timeIntervalSince1970 * 1000))) + let maxLength: Int = !rawReaction.you || reactors.contains(userPublicKey) ? 5 : 4 let desiredReactorIds: [String] = reactors .filter { $0 != blindedUserPublicKey } + .prefix(maxLength) + .map{ $0 } results = results .appending( // Add the first reaction (with the count) diff --git a/SessionMessagingKit/Open Groups/OpenGroupAPI.swift b/SessionMessagingKit/Open Groups/OpenGroupAPI.swift index bcef9def5..e27f93428 100644 --- a/SessionMessagingKit/Open Groups/OpenGroupAPI.swift +++ b/SessionMessagingKit/Open Groups/OpenGroupAPI.swift @@ -99,7 +99,7 @@ public enum OpenGroupAPI { ), queryParameters: [ .updateTypes: UpdateTypes.reaction.rawValue, - .reactors: "20" + .reactors: "5" ] ), responseType: [Failable].self