From 57e41a15c4b0fcf39fd9ffddeba44ce75c90894d Mon Sep 17 00:00:00 2001 From: Pjaijai <87293994+Pjaijai@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:08:17 -0400 Subject: [PATCH] Feature/update notify unseen conversation (#341) * chore(release): 1.13.0 * feat(cron notify-unseen-conversation support pdf): cron notify-unseen-conversation support pdf --------- Co-authored-by: Pjaijai --- CHANGELOG.md | 22 ++++++++++++ package.json | 2 +- .../notify-unseen-conversation/index.ts | 34 +++++++++++++------ 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bce78dc..0f2404e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,28 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.13.1](https://github.com/Pjaijai/Referalah/compare/v1.13.0...v1.13.1) (2024-03-29) + +## [1.13.0](https://github.com/Pjaijai/Referalah/compare/v1.12.3...v1.13.0) (2024-03-29) + + +### Features + +* add fancy background ([#335](https://github.com/Pjaijai/Referalah/issues/335)) ([41a113f](https://github.com/Pjaijai/Referalah/commit/41a113fc1dd77d0d6205e0b1e48de3232f05fc14)) + + +### Bug Fixes + +* fix copy ([7fd3e79](https://github.com/Pjaijai/Referalah/commit/7fd3e7923d881eb7dbf7130f6d4899574beb7e33)) +* fix fancy background showing logic ([0cdc69b](https://github.com/Pjaijai/Referalah/commit/0cdc69b10188b005f3f4c759ed9152d5138cdd35)) +* fix infinite scroll infinite loading problem ([6d89fd5](https://github.com/Pjaijai/Referalah/commit/6d89fd5668967188d376d8080348714afc2e592e)) +* fix typo ([d890b8c](https://github.com/Pjaijai/Referalah/commit/d890b8c465b5afbe34c6dd97a1224e0a29061cc0)) +* fix ui ([#339](https://github.com/Pjaijai/Referalah/issues/339)) ([70b798c](https://github.com/Pjaijai/Referalah/commit/70b798c36920f39ebbc12dd8f465c346de50ddde)) +* fix word break ([10b3583](https://github.com/Pjaijai/Referalah/commit/10b35838dbcdd068b760c307fa234a15dfa1ecbc)) +* fix yoe in referral post card ([29d771d](https://github.com/Pjaijai/Referalah/commit/29d771d580cbb1341157bc2d3be2ba68dd0b46f8)) +* remove github in header ([d3ba81d](https://github.com/Pjaijai/Referalah/commit/d3ba81dc862c4812dfa9f42cf5f8c912b1177348)) +* replace reset icon with copy ([6b2feae](https://github.com/Pjaijai/Referalah/commit/6b2feae43c10453a50668f2aa4ccd70ab0f87607)) + ### [1.12.3](https://github.com/Pjaijai/Referalah/compare/v1.12.2...v1.12.3) (2024-03-07) diff --git a/package.json b/package.json index b8d76a13..2f5b46e7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Referalah", "description": "An open source online platform for oversea Hong Kong People to connect each other", - "version": "1.12.3", + "version": "1.13.1", "license": "Apache-2.0", "scripts": { "prepare": "husky install .husky", diff --git a/supabase/functions/notify-unseen-conversation/index.ts b/supabase/functions/notify-unseen-conversation/index.ts index b10e2102..9a5170dc 100644 --- a/supabase/functions/notify-unseen-conversation/index.ts +++ b/supabase/functions/notify-unseen-conversation/index.ts @@ -36,7 +36,6 @@ serve(async (req: any) => { }) const { data: users } = await server.from("user").select("*") - const limiter = new Bottleneck({ minTime: 180, maxConcurrent: 1, @@ -52,7 +51,8 @@ serve(async (req: any) => { receiver_uuid(uuid,username, email), last_message_uuid( sender_uuid, - body + body, + document ), is_sender_seen, is_receiver_seen @@ -72,20 +72,34 @@ serve(async (req: any) => { conversation.last_message_uuid.sender_uuid !== user.uuid && index < 5 ) { - unseenConversationList.push({ - username: conversation.receiver_uuid.username, - body: conversation.last_message_uuid.body, - }) + if (conversation.last_message_uuid.body) { + unseenConversationList.push({ + username: conversation.receiver_uuid.username, + body: conversation.last_message_uuid.body, + }) + } else { + unseenConversationList.push({ + username: conversation.receiver_uuid.username, + body: conversation.last_message_uuid.document.name, + }) + } } else if ( conversation.receiver_uuid.uuid === user.uuid && conversation.is_receiver_seen === false && conversation.last_message_uuid.sender_uuid !== user.uuid && index < 5 ) { - unseenConversationList.push({ - username: conversation.sender_uuid.username, - body: conversation.last_message_uuid.body, - }) + if (conversation.last_message_uuid.body) { + unseenConversationList.push({ + username: conversation.sender_uuid.username, + body: conversation.last_message_uuid.body, + }) + } else { + unseenConversationList.push({ + username: conversation.sender_uuid.username, + body: conversation.last_message_uuid.document.name, + }) + } } else { break }