Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tenor: Fix off-by-one error in `last_gif_index`.
apoorvapendse01dd0dc7463a
diff --git a/web/src/tenor.ts b/web/src/tenor.tsindex 66068ee3291..be10e7766a9 100644--- a/web/src/tenor.ts+++ b/web/src/tenor.ts@@ -51,7 +51,7 @@ let tenor_popover_instance: tippy.Instance | undefined;let current_search_term: undefined | string;const BASE_URL = "https://tenor.googleapis.com/v2";// Stores the index of the last GIF that is part of the grid.-let last_gif_index = 0;+let last_gif_index = -1;type TenorPayload = {key: string;@@ -173,15 +173,15 @@ function render_gifs_to_grid(raw_tenor_result: unknown, next_page: boolean): voilet gif_grid_html = "";if (!next_page) {- last_gif_index = 0;+ last_gif_index = -1;}for (const url of urls) {+ last_gif_index += 1;gif_grid_html += render_tenor_gif({preview_url: url.preview_url,insert_url: url.insert_url,gif_index: last_gif_index,});- last_gif_index += 1;}const $popper = $(tenor_popover_instance.popper);if (next_page) {