From fe330eaf544883373f3eb7613c74b47e4ac32af1 Mon Sep 17 00:00:00 2001 From: j <13580441+gary02@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:07:37 +0800 Subject: [PATCH 1/3] Revert "feat(notice): remove comment-liked notice trigger temporarily" --- src/mutations/comment/voteComment.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/mutations/comment/voteComment.ts b/src/mutations/comment/voteComment.ts index 9c125a827..b0e361fd1 100644 --- a/src/mutations/comment/voteComment.ts +++ b/src/mutations/comment/voteComment.ts @@ -1,13 +1,21 @@ import type { GQLMutationResolvers, Article, Circle } from 'definitions' -import { COMMENT_TYPE, USER_STATE } from 'common/enums' +import { COMMENT_TYPE, USER_STATE, VOTE, DB_NOTICE_TYPE } from 'common/enums' import { ForbiddenByStateError, ForbiddenError } from 'common/errors' import { fromGlobalId } from 'common/utils' const resolver: GQLMutationResolvers['voteComment'] = async ( _, { input: { id, vote } }, - { viewer, dataSources: { atomService, paymentService, commentService } } + { + viewer, + dataSources: { + atomService, + paymentService, + commentService, + notificationService, + }, + } ) => { if (!viewer.userName) { throw new ForbiddenError('user has no username') @@ -65,6 +73,15 @@ const resolver: GQLMutationResolvers['voteComment'] = async ( await commentService.vote({ commentId: dbId, vote, userId: viewer.id }) + if (vote === VOTE.up) { + notificationService.trigger({ + event: DB_NOTICE_TYPE.comment_liked, + actorId: viewer.id, + recipientId: comment.authorId, + entities: [{ type: 'target', entityTable: 'comment', entity: comment }], + }) + } + return comment } From 9e75c4bf6e3c8e25cde167ce58af9bd23548b1fc Mon Sep 17 00:00:00 2001 From: j <13580441+gary02@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:45:19 +0800 Subject: [PATCH 2/3] chore: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 513f1d772..70af00264 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matters-server", - "version": "5.0.5", + "version": "5.1.0", "description": "Matters Server", "author": "Matters ", "main": "build/index.js", From dc34a0accb384406cd111adf268e06e4618bef14 Mon Sep 17 00:00:00 2001 From: j <13580441+gary02@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:55:54 +0800 Subject: [PATCH 3/3] chore: bump version --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b4d1f66e..f9fc27597 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "matters-server", - "version": "5.0.5", + "version": "5.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "matters-server", - "version": "5.0.5", + "version": "5.1.0", "license": "Apache-2.0", "dependencies": { "@apollo/cache-control-types": "^1.0.2",