feat: added new DEFAULT_QA_STORY_MODE feature flag (#2905)

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
This commit is contained in:
Wyatt Johnson
2020-03-26 18:31:48 -04:00
committed by GitHub
co-authored by Kim Gardner
parent 071666e8b8
commit 0f9b2ba114
2 changed files with 14 additions and 1 deletions
@@ -1,6 +1,8 @@
import * as story from "coral-server/models/story";
import { hasFeatureFlag } from "coral-server/models/tenant";
import {
GQLFEATURE_FLAG,
GQLSTORY_MODE,
GQLStorySettingsTypeResolver,
} from "../schema/__generated__/types";
@@ -21,11 +23,17 @@ export const StorySettings: GQLStorySettingsTypeResolver<
enabled: false,
};
},
mode: s => {
// FEATURE_FLAG:ENABLE_QA
mode: (s, input, ctx) => {
if (s.mode) {
return s.mode;
}
// FEATURE_FLAG:DEFAULT_QA_STORY_MODE
if (hasFeatureFlag(ctx.tenant, GQLFEATURE_FLAG.DEFAULT_QA_STORY_MODE)) {
return GQLSTORY_MODE.QA;
}
return GQLSTORY_MODE.COMMENTS;
},
experts: (s, input, ctx) => {
@@ -353,6 +353,11 @@ enum FEATURE_FLAG {
ENABLE_QA when enabled will turn off Q&A features client side.
"""
ENABLE_QA
"""
DEFAULT_QA_STORY_MODE will set the story mode to QA by default.
"""
DEFAULT_QA_STORY_MODE
}
# The moderation mode of the site.