From c7fb6e30870ea1abff13a8214107e0747d293320 Mon Sep 17 00:00:00 2001
From: Lauris BH <lauris@nix.lv>
Date: Wed, 6 Dec 2017 05:17:50 +0200
Subject: [PATCH] Fix reaction possition when there is attachments (#3099)

---
 public/js/index.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/public/js/index.js b/public/js/index.js
index c56030f349..28377ce231 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -151,7 +151,13 @@ function initReactionSelector(parent) {
                     react.remove();
                 }
                 if (!resp.empty) {
-                    react = $('<div class="ui attached segment reactions"></div>').appendTo(content);
+                    react = $('<div class="ui attached segment reactions"></div>');
+                    var attachments = content.find('.segment.bottom:first');
+                    if (attachments.length > 0) {
+                        react.insertBefore(attachments);
+                    } else {
+                        react.appendTo(content);
+                    }
                     react.html(resp.html);
                     var hasEmoji = react.find('.has-emoji');
                     for (var i = 0; i < hasEmoji.length; i++) {