From 9a05ff524758b051c05568e01869a2884a4c7310 Mon Sep 17 00:00:00 2001 From: "Cayo P. R. Oliveira" Date: Thu, 19 Mar 2026 22:35:04 -0300 Subject: [PATCH] feat: find scheduled message (#237) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(scheduled-messages): scroll to sent message from sidebar - Expose message_id in JBuilder serialization and push_event_data - Add HIGHLIGHT_MESSAGE bus event for in-page message highlighting - Add 'Go to message' button on sent scheduled messages in sidebar - Enhance onScrollToMessage to fetch messages around target when not in DOM - Extend Message.vue highlight to work with bus events (not just route query) - Add i18n keys for EN and pt-BR Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor(scheduled-messages): make sent card clickable instead of button Replace the 'Go to message' button with a clickable card. The entire sent scheduled message card now has cursor-pointer, hover highlight, and a tooltip — clicking anywhere on it scrolls to the message. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(scheduled-messages): address PR review feedback - Use camelCase value for HIGHLIGHT_MESSAGE bus event ('highlightMessage') - Show toast alert when message not found after fetch or on fetch error - Use the MESSAGE_NOT_FOUND i18n key that was previously unused Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(scheduled-messages): use messageId query param for find message Replace direct bus event emission with route navigation using ?messageId= query param, reusing the same proven mechanism used by search results and copy-message-link. Changes: - ScheduledMessageItem: router.replace with ?messageId= instead of emitting SCROLL_TO_MESSAGE directly - ConversationView: handle ?messageId= on same-conversation (was previously skipped), fetch messages around target and scroll - MessagesView: clean up ?messageId= from URL after scroll/error Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(scheduled-messages): add toast feedback for find message Show a persistent "Searching for message..." toast while fetching, auto-dismissed on success. Show "Message not found" error toast if the message cannot be located. Uses usePendingAlert for the loading state in both ConversationView (initial fetch) and MessagesView (fallback fetch). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: prevent scroll overshoot when navigating to message Remove the immediate fetchPreviousMessages() call after scrollIntoView({ behavior: smooth }). The fetch was prepending messages above the target while the smooth scroll animation was still running, shifting the DOM and causing the scroll to stop short of the target message. The scroll event handler will naturally trigger message loading when the user scrolls up later. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore(scheduled-messages): remove redundant clearMessageIdFromRoute calls --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../components/ScheduledMessageItem.vue | 29 +++++++++- .../components-next/message/Message.vue | 20 ++++++- .../widgets/conversation/MessagesView.vue | 33 ++++++++++- .../i18n/locale/en/conversation.json | 5 +- .../i18n/locale/pt_BR/conversation.json | 5 +- .../conversation/ConversationView.vue | 55 +++++++++++++++---- app/javascript/shared/constants/busEvents.js | 1 + app/models/scheduled_message.rb | 1 + .../models/_scheduled_message.json.jbuilder | 1 + 9 files changed, 133 insertions(+), 17 deletions(-) diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsSidebar/components/ScheduledMessageItem.vue b/app/javascript/dashboard/components-next/Contacts/ContactsSidebar/components/ScheduledMessageItem.vue index 7cb071ba0..2d1df490a 100644 --- a/app/javascript/dashboard/components-next/Contacts/ContactsSidebar/components/ScheduledMessageItem.vue +++ b/app/javascript/dashboard/components-next/Contacts/ContactsSidebar/components/ScheduledMessageItem.vue @@ -1,6 +1,7 @@