diff --git a/app/components/newsPage/cards/NewsCollabCommentCard.tsx b/app/components/newsPage/cards/NewsCollabCommentCard.tsx index b985424..18bea11 100644 --- a/app/components/newsPage/cards/NewsCollabCommentCard.tsx +++ b/app/components/newsPage/cards/NewsCollabCommentCard.tsx @@ -60,14 +60,6 @@ export function useNewsCollabCommentCard(props: NewsCollabCommentCardProps) { const item = entry.item as CollaborationComment; const question = item.question; - if (!question) { - errorMessage({ message: m.components_collaboration_comments_collaborationCommentCard_questionMissing() }); - appInsights.trackException({ - exception: new Error('Failed to get collaboration question'), - severityLevel: SeverityLevel.Error, - }); - } - const [comment, setComment] = useState(item); const state = useEditingState(); diff --git a/app/services/collaborationCommentService.ts b/app/services/collaborationCommentService.ts index 6a5bba7..e591dab 100644 --- a/app/services/collaborationCommentService.ts +++ b/app/services/collaborationCommentService.ts @@ -5,7 +5,6 @@ import { addCommentToDb, deleteCommentInDb, getCommentById, - getCommentLikes, getCommentResponseCount, handleCommentLike, updateCommentInDb, @@ -189,7 +188,6 @@ export const createNewsFeedEntryForComment = async (comment: Comment, user?: Use const author = user ?? comment.author; const commentCount = (await getCommentResponseCount(dbClient, comment.id)) || 0; - const likedBy = await getCommentLikes(dbClient, comment.id); //todo const reactions = await getReactionsForEntity(dbClient, ObjectType.COLLABORATION_COMMENT, comment.id); const followerIds = await getFollowedByForEntity(dbClient, ObjectType.PROJECT, question.projectId); const followers = await mapToRedisUsers(followerIds); diff --git a/app/services/commentService.ts b/app/services/commentService.ts index 2e1f211..ab99982 100644 --- a/app/services/commentService.ts +++ b/app/services/commentService.ts @@ -74,7 +74,7 @@ export const removeComment = async ({ user, commentId }: RemoveComment) => { const updateCommentInCache = async (comment: { objectId: string; objectType: ObjectType }, author: UserSession) => { const commentCount = await countComments(dbClient, comment.objectId); - const body = { id: comment.objectId, responseCount: commentCount }; + const body = { id: comment.objectId, commentCount }; return comment.objectType === 'POST' ? await updatePostInCache({ post: body, user: author }) : await updateProjectUpdateInCache({ update: body }); @@ -82,7 +82,7 @@ const updateCommentInCache = async (comment: { objectId: string; objectType: Obj const removeCommentInCache = async (comment: { objectId: string; objectType: ObjectType }, author: UserSession) => { const commentCount = await countComments(dbClient, comment.objectId); - const body = { id: comment.objectId, responseCount: commentCount }; + const body = { id: comment.objectId, commentCount }; return comment.objectType === 'POST' ? await updatePostInCache({ post: body, user: author }) : await updateProjectUpdateInCache({ update: body }); diff --git a/app/services/updateService.ts b/app/services/updateService.ts index 8719569..5b98387 100644 --- a/app/services/updateService.ts +++ b/app/services/updateService.ts @@ -1,7 +1,6 @@ 'use server'; import { ObjectType, ProjectUpdate } from '@/common/types'; -import { countComments } from '@/repository/db/comment'; import { getFollowedByForEntity } from '@/repository/db/follow'; import dbClient from '@/repository/db/prisma/prisma'; import { getReactionsForEntity } from '@/repository/db/reaction'; diff --git a/app/utils/newsFeed/newsFeedSync.ts b/app/utils/newsFeed/newsFeedSync.ts index d590d3b..29bdd42 100644 --- a/app/utils/newsFeed/newsFeedSync.ts +++ b/app/utils/newsFeed/newsFeedSync.ts @@ -21,6 +21,7 @@ import { getBasicCollaborationQuestionStartingFromWithAdditionalData } from '@/u import { getProjectsStartingFrom } from '@/utils/requests/project/requests'; import { mapToComment } from '../requests/comments/mapping'; +import { saveEntryNewsComments } from '../requests/comments/requests'; import { getEventsStartingFrom } from '../requests/events/requests'; import { getSurveyQuestionsStartingFrom } from '../requests/surveyQuestions/requests'; import { getProjectUpdatesStartingFrom } from '../requests/updates/requests'; @@ -33,7 +34,6 @@ import { transactionalDeleteItemsFromRedis, transactionalSaveNewsFeedEntry, } from './redis/redisService'; -import { saveEntryNewsComments } from '../requests/comments/requests'; const logger = getLogger(); const maxSyncRetries = 3;