diff --git a/src/main/java/eu/siacs/conversations/entities/Reaction.java b/src/main/java/eu/siacs/conversations/entities/Reaction.java index abf93462b..4f1252f58 100644 --- a/src/main/java/eu/siacs/conversations/entities/Reaction.java +++ b/src/main/java/eu/siacs/conversations/entities/Reaction.java @@ -92,6 +92,22 @@ public class Reaction { } } + public static Collection withMine( + final Collection existing, + final Collection reactions, + final boolean received, + final Jid from, + final Jid trueJid, + final String occupantId, + final String envelopeId) { + final ImmutableSet.Builder builder = new ImmutableSet.Builder<>(); + builder.addAll(Collections2.filter(existing, e -> e.received)); + builder.addAll( + Collections2.transform( + reactions, r -> new Reaction(r, null, received, from, trueJid, occupantId, envelopeId))); + return builder.build(); + } + public static Collection withOccupantId( final Collection existing, final Collection reactions, diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 4dba3ecc7..b34973e45 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -5381,13 +5381,9 @@ public class XmppConnectionService extends Service { if (conversation.getMode() == Conversational.MODE_MULTI) { final var self = conversation.getMucOptions().getSelf(); final String occupantId = self.getOccupantId(); - if (Strings.isNullOrEmpty(occupantId)) { - Log.d(Config.LOGTAG, "occupant id not found for reaction in MUC"); - return false; - } reactToId = message.getServerMsgId(); combinedReactions = - Reaction.withOccupantId( + Reaction.withMine( message.getReactions(), reactions, false,