From 9a12d1798ea84d1663507272b48a37e4d9f18cf8 Mon Sep 17 00:00:00 2001 From: Sayam Samal Date: Tue, 13 Feb 2024 16:16:05 +0530 Subject: [PATCH] read_receipts: Fix duplication bug when opening menu repeatedly. The (1) delay in fetching the read receipts data from the api call to `/json/messages/${message_id}/read_receipts`; followed by the execution of the success callback function, and the (2) use of `.append()` to render the modal and user list, together lead to duplication of the read receipts modal and also the user list inside the read receipts menu. This commit adds a check to set the read receipts menu contents only if the read receipts modal for the selected message ID is open by the time the network request is resolved. In addition, this commit also uses the `on_shown` hook instead of the `on_show` hook in the read receipts modal logic, to add a delay in the calling of the read receipts API, which prevents the stacking of the requests. --- templates/zerver/app/index.html | 2 ++ web/src/read_receipts.ts | 14 +++++++++++--- web/styles/dark_theme.css | 2 +- web/styles/modal.css | 2 +- web/templates/read_receipts.hbs | 14 ++++++-------- web/templates/read_receipts_modal.hbs | 3 ++- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html index 2c24692720..bbac12d393 100644 --- a/templates/zerver/app/index.html +++ b/templates/zerver/app/index.html @@ -161,6 +161,8 @@
+
+