Compare commits

..

2 Commits

Author SHA1 Message Date
Abhinav Raut
71601364ae fix: mark conversation as read when messages are already cached 2025-02-26 17:41:25 +05:30
Abhinav Raut
44723fb70d fix: update command to start backend dev server in documentation 2025-02-26 12:11:15 +05:30
2 changed files with 4 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ git clone https://github.com/abhinavxd/libredesk.git
### Running the Dev Environment
1. Run `make run` to start the libredesk backend dev server on `:9000`.
1. Run `make run-backend` to start the libredesk backend dev server on `:9000`.
2. Run `make run-frontend` to start the Vue frontend in dev mode using pnpm on `:8000`. Requests are proxied to the backend running on `:9000` check `vite.config.js` for the proxy config.
---

View File

@@ -282,8 +282,10 @@ export const useConversationStore = defineStore('conversation', () => {
async function fetchMessages (uuid, fetchNextPage = false) {
// Messages are already cached?
let hasMessages = messages.data.getAllPagesMessages(uuid)
if (hasMessages.length > 0 && !fetchNextPage)
if (hasMessages.length > 0 && !fetchNextPage) {
markConversationAsRead(uuid)
return
}
// Fetch messages from server.
messages.loading = true
@@ -293,7 +295,6 @@ export const useConversationStore = defineStore('conversation', () => {
const response = await api.getConversationMessages(uuid, { page: page, page_size: MESSAGE_LIST_PAGE_SIZE })
const result = response.data?.data || {}
const newMessages = result.results || []
// Mark conversation as read
markConversationAsRead(uuid)
// Cache messages
messages.data.addMessages(uuid, newMessages, result.page, result.total_pages)