From 115af05a0bfe8fc0a4162d199c9ad2dbce271b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Tue, 13 Jan 2026 15:24:38 +0300 Subject: [PATCH] fix: Syntax error in loadLatest method Fixed incorrect method placement that broke loadNewer. loadLatest now properly placed after loadNewer method. --- backend/static/js/loaders/messageLoaderV2.js | 54 ++++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/backend/static/js/loaders/messageLoaderV2.js b/backend/static/js/loaders/messageLoaderV2.js index de35cdfc..9dc021ed 100644 --- a/backend/static/js/loaders/messageLoaderV2.js +++ b/backend/static/js/loaders/messageLoaderV2.js @@ -245,33 +245,6 @@ export class MessageLoaderV2 { * @returns {Promise>} */ async loadNewer(chatId, limit = null) { - - /** - * Загружает последние сообщения (самые свежие в чате) - * Используется для перехода к настоящему времени из исторического просмотра - * @param {number} chatId - ID чата - * @param {number} [limit] - Количество сообщений - * @returns {Promise} - */ - async loadLatest(chatId, limit = 50) { - const requestKey = `latest_${chatId}`; - - console.log('[MessageLoaderV2] Loading latest messages to present time'); - - try { - const result = await this._loadLatest(chatId, limit, requestKey); - - // Эмитим событие - window.dispatchEvent(new CustomEvent('chat:messagesLoaded', { - detail: { chatId, count: result.messages.length, type: 'latest' } - })); - - return result; - } catch (error) { - console.error('[MessageLoaderV2] Failed to load latest:', error); - throw error; - } - } const requestKey = `newer_${chatId}`; const state = this._getLoadingState(chatId); @@ -349,6 +322,33 @@ export class MessageLoaderV2 { } } + /** + * Загружает последние сообщения (самые свежие в чате) + * Используется для перехода к настоящему времени из исторического просмотра + * @param {number} chatId - ID чата + * @param {number} [limit] - Количество сообщений + * @returns {Promise} + */ + async loadLatest(chatId, limit = 50) { + const requestKey = `latest_${chatId}`; + + console.log('[MessageLoaderV2] Loading latest messages to present time'); + + try { + const result = await this._loadLatest(chatId, limit, requestKey); + + // Эмитим событие + window.dispatchEvent(new CustomEvent('chat:messagesLoaded', { + detail: { chatId, count: result.messages.length, type: 'latest' } + })); + + return result; + } catch (error) { + console.error('[MessageLoaderV2] Failed to load latest:', error); + throw error; + } + } + /** * Загружает сообщения вокруг указанной даты (timestamp) * Используется для навигации по датам через date picker