[CORL-239, CORL-128] Support disabled commenting and closed stories in Stream (#2205)

* feat: closed story + disabled commenting

* test: add feature test and fix bugs

* fix: snapshot

* fix: isClosed can't be null

* fix: remove duplicate DeepPartial type

* fix: border color
This commit is contained in:
Kiwi
2019-03-04 23:27:46 +01:00
committed by GitHub
parent 625809b42c
commit 4e043638f6
52 changed files with 1974 additions and 1246 deletions
@@ -7,7 +7,10 @@ import { storyModerationInputResolver } from "./ModerationQueues";
export const Story: GQLStoryTypeResolver<story.Story> = {
comments: (s, input, ctx) => ctx.loaders.Comments.forStory(s.id, input),
isClosed: () => false,
isClosed: (s, input, ctx) => {
const closedAt = getStoryClosedAt(ctx.tenant, s);
return !!closedAt && new Date() >= closedAt;
},
closedAt: (s, input, ctx) => getStoryClosedAt(ctx.tenant, s),
commentActionCounts: s => decodeActionCounts(s.commentCounts.action),
commentCounts: s => s.commentCounts.status,