diff --git a/files/assets/js/gif_modal.js b/files/assets/js/gif_modal.js
index ecd05aee4..47e487d03 100644
--- a/files/assets/js/gif_modal.js
+++ b/files/assets/js/gif_modal.js
@@ -27,8 +27,8 @@ gifModal.addEventListener('shown.bs.modal', function () {
}, 1000);
});
-async function show_gif_categories(form) {
- commentFormID = form;
+async function show_gif_categories(t, form) {
+ if (form) commentFormID = form;
gifSearchBar.value = null;
noGIFs.classList.add("d-none");
@@ -112,14 +112,22 @@ async function show_gif_categories(form) {
element.addEventListener('click', () => {searchGifs(element.firstElementChild.innerHTML)});
}
- gifModal.addEventListener('hide.bs.modal', () => {
- setTimeout(() => {
- document.getElementById(commentFormID).focus();
- }, 200);
- }, {once : true});
+ if (t) {
+ if (t.dataset.previousModal) {
+ gifModal.addEventListener('hide.bs.modal', () => {
+ bootstrap.Modal.getOrCreateInstance(document.getElementById(t.dataset.previousModal)).show()
+ }, {once : true});
+ }
+
+ gifModal.addEventListener('hide.bs.modal', () => {
+ setTimeout(() => {
+ document.getElementById(commentFormID).focus();
+ }, 200);
+ }, {once : true});
+ }
}
-document.getElementById('gifs-back-btn').addEventListener('click', show_gif_categories);
+document.getElementById('gifs-back-btn').addEventListener('click', () => show_gif_categories(null, null));
async function searchGifs(searchTerm) {
diff --git a/files/templates/modals/award.html b/files/templates/modals/award.html
index 1ce099cbb..3d8a6c78f 100644
--- a/files/templates/modals/award.html
+++ b/files/templates/modals/award.html
@@ -57,6 +57,7 @@
{{macros.emoji_btn('note', 'awardModal')}}
+ {{macros.gif_btn('note', 'awardModal')}}
diff --git a/files/templates/util/macros.html b/files/templates/util/macros.html
index 04cbdc17e..48ec71814 100644
--- a/files/templates/util/macros.html
+++ b/files/templates/util/macros.html
@@ -114,8 +114,8 @@
{% endmacro %}
-{% macro gif_btn(textarea_id) %}
-
+{% macro gif_btn(textarea_id, previous_modal) %}
+
{% endmacro %}
{% macro file_btn(input_id, disabled, image_only) %}