1
0
Fork 1

Loosen requirement to have occupant id to send reaction

(cherry picked from commit d35ebbae226b99a239e3da7f4a70685cfaad6c43)
This commit is contained in:
Stephen Paul Weber 2024-10-04 21:24:27 -05:00 committed by Arne
parent 3b52d2b118
commit 841a0ed909
2 changed files with 17 additions and 5 deletions

View file

@ -92,6 +92,22 @@ public class Reaction {
}
}
public static Collection<Reaction> withMine(
final Collection<Reaction> existing,
final Collection<String> reactions,
final boolean received,
final Jid from,
final Jid trueJid,
final String occupantId,
final String envelopeId) {
final ImmutableSet.Builder<Reaction> 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<Reaction> withOccupantId(
final Collection<Reaction> existing,
final Collection<String> reactions,

View file

@ -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,