Skip to content

Commit

Permalink
Don't fetch posts text as it's not used
Browse files Browse the repository at this point in the history
  • Loading branch information
thesan committed Mar 3, 2024
1 parent b1bdc8f commit 2cd3f72
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 16 deletions.
4 changes: 0 additions & 4 deletions packages/server/src/notifier/model/email/utils/forum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ interface ForumPost {
author: string
threadId: string
thread: string
text: string
}
const cachedForumPosts: { [id: string]: ForumPost } = {}
export const getForumPost = async (id: string): Promise<ForumPost> => {
Expand All @@ -21,7 +20,6 @@ export const getForumPost = async (id: string): Promise<ForumPost> => {
author: post.author.handle,
threadId: post.thread.id,
thread: post.thread.title,
text: post.text,
}
}

Expand All @@ -31,7 +29,6 @@ export const getForumPost = async (id: string): Promise<ForumPost> => {
interface ForumThread {
author: string
title: string
text?: string
}
const cachedForumThreads: { [id: string]: ForumThread } = {}
export const getForumThread = async (id: string): Promise<ForumThread> => {
Expand All @@ -44,7 +41,6 @@ export const getForumThread = async (id: string): Promise<ForumThread> => {
cachedForumThreads[id] = {
author: thread.author.handle,
title: thread.title,
text: thread.initialPost?.text,
}
}

Expand Down
4 changes: 0 additions & 4 deletions packages/server/src/notifier/queries/entities/forum.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ query GetPost($id: ID!) {
id
title
}
text
}
}

Expand All @@ -17,9 +16,6 @@ query GetThread($id: ID!) {
handle
}
title
initialPost {
text
}
}
}

Expand Down
9 changes: 1 addition & 8 deletions packages/server/test/notifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ describe('Notifier', () => {
forumPostByUniqueInput: {
author: { handle: 'author:handle' },
thread: { id: 'thread:id', title: 'thread:title' },
text: 'Lorem Ipsum',
},
})

Expand Down Expand Up @@ -306,7 +305,6 @@ describe('Notifier', () => {
forumPostByUniqueInput: {
author: { handle: 'author:handle' },
thread: { id: 'thread:id', title: 'thread:title' },
text: 'Lorem Ipsum',
},
})
// -------------------
Expand Down Expand Up @@ -385,11 +383,7 @@ describe('Notifier', () => {
return { forumCategoryByUniqueInput: { parentId: variables.id === 'bar' ? 'foo' : null } }
case GetThreadDocument:
return {
forumThreadByUniqueInput: {
author: { handle: 'author:handle' },
title: `${variables.id}:title`,
initialPost: { text: 'Lorem Ipsum' },
},
forumThreadByUniqueInput: { author: { handle: 'author:handle' }, title: `${variables.id}:title` },
}
}
})
Expand Down Expand Up @@ -812,7 +806,6 @@ describe('Notifier', () => {
forumPostByUniqueInput: {
author: { handle: 'author:handle' },
thread: { id: 'thread:id', title: 'thread:title' },
text: 'Lorem Ipsum',
},
})

Expand Down

0 comments on commit 2cd3f72

Please sign in to comment.