feat: support auto-pause live updates (#2947)

Co-authored-by: Vinh <vinh@vinh.tech>
This commit is contained in:
Wyatt Johnson
2020-05-07 16:21:37 +00:00
committed by GitHub
co-authored by Vinh
parent 1624787004
commit d0ab2ef8c5
8 changed files with 141 additions and 46 deletions
@@ -136,6 +136,15 @@ const mutation = graphql`
...AllCommentsTabContainer_comment @relay(mask: false)
id
status
story {
settings {
# Load the story live settings so new comments can verify if live
# updates are still enabled (and enable then if they are).
live {
enabled
}
}
}
parent {
id
tags {
@@ -234,6 +243,14 @@ async function commit(
dontAgree: false,
flag: false,
},
story: {
id: input.storyID,
settings: {
live: {
enabled: storySettings.live.enabled,
},
},
},
replies: {
edges: [],
pageInfo: { endCursor: null, hasNextPage: false },
@@ -131,6 +131,15 @@ const mutation = graphql`
node {
...AllCommentsTabContainer_comment @relay(mask: false)
status
story {
settings {
# Load the story live settings so new comments can verify if live
# updates are still enabled (and enable then if they are).
live {
enabled
}
}
}
}
}
clientMutationId
@@ -219,6 +228,14 @@ async function commit(
edges: [],
pageInfo: { endCursor: null, hasNextPage: false },
},
story: {
id: input.storyID,
settings: {
live: {
enabled: storySettings.live.enabled,
},
},
},
deleted: false,
},
},
+36 -34
View File
@@ -260,6 +260,41 @@ export const commenters = createFixtures<GQLUser>(
baseUser
);
export const baseStory = createFixture<GQLStory>({
id: "story-0",
metadata: {
title: "title",
},
isClosed: false,
comments: {
edges: [],
pageInfo: {
hasNextPage: false,
},
},
commentCounts: {
totalPublished: 0,
tags: {
FEATURED: 0,
UNANSWERED: 0,
},
},
settings: {
moderation: GQLMODERATION_MODE.POST,
premodLinksEnable: false,
messageBox: {
enabled: false,
},
live: {
enabled: true,
configurable: true,
},
mode: GQLSTORY_MODE.COMMENTS,
experts: [],
},
site,
});
export const baseComment = createFixture<GQLComment>({
author: commenters[0],
body: "Comment Body",
@@ -279,6 +314,7 @@ export const baseComment = createFixture<GQLComment>({
total: 0,
},
},
story: baseStory,
parent: undefined,
viewerActionPresence: { reaction: false, dontAgree: false, flag: false },
tags: [],
@@ -514,40 +550,6 @@ export const commentWithDeepestReplies = denormalizeComment(
})
);
export const baseStory = createFixture<GQLStory>({
metadata: {
title: "title",
},
isClosed: false,
comments: {
edges: [],
pageInfo: {
hasNextPage: false,
},
},
commentCounts: {
totalPublished: 0,
tags: {
FEATURED: 0,
UNANSWERED: 0,
},
},
settings: {
moderation: GQLMODERATION_MODE.POST,
premodLinksEnable: false,
messageBox: {
enabled: false,
},
live: {
enabled: true,
configurable: true,
},
mode: GQLSTORY_MODE.COMMENTS,
experts: [],
},
site,
});
export const moderators = createFixtures<GQLUser>(
[
{