Do not include fallback quote on direct reply

Stephen Paul Weber created

It may be too close to the preceeding message and confusing looking on clients
that use the fallback.

Change summary

src/main/java/eu/siacs/conversations/entities/Message.java               |  4 
src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 10 
2 files changed, 12 insertions(+), 2 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/entities/Message.java 🔗

@@ -514,6 +514,10 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
         }
     }
 
+    public synchronized void clearFallbacks() {
+        this.payloads.removeAll(getFallbacks());
+    }
+
     public synchronized void setBody(String body) {
         if (body == null) {
             throw new Error("You should not set the message body to null");

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -139,6 +139,7 @@ import eu.siacs.conversations.utils.Compatibility;
 import eu.siacs.conversations.utils.Consumer;
 import eu.siacs.conversations.utils.ConversationsFileObserver;
 import eu.siacs.conversations.utils.CryptoHelper;
+import eu.siacs.conversations.utils.Emoticons;
 import eu.siacs.conversations.utils.EasyOnboardingInvite;
 import eu.siacs.conversations.utils.ExceptionHelper;
 import eu.siacs.conversations.utils.MimeUtils;
@@ -1040,8 +1041,13 @@ public class XmppConnectionService extends Service {
         final Message inReplyTo = lastMessageUuid == null ? null : conversation.findMessageWithUuid(lastMessageUuid);
         Message message = new Message(conversation, body, conversation.getNextEncryption());
         if (inReplyTo != null) {
-            message = inReplyTo.reply();
-            message.appendBody(body);
+            if (Emoticons.isEmoji(body)) {
+                message = inReplyTo.react(body);
+            } else {
+                message = inReplyTo.reply();
+            }
+            message.clearFallbacks();
+            message.setBody(body);
             message.setEncryption(conversation.getNextEncryption());
         }
         if (inReplyTo != null && inReplyTo.isPrivateMessage()) {