[CORL-158] Open/Close stream inside of configure tab (#2223)

* feat: Open or Close stream inside of configure tab

* feat: default disable/close commenting message

* fix: adjusted tests
This commit is contained in:
Kiwi
2019-03-19 18:30:44 +01:00
committed by GitHub
parent 5a7340ac3a
commit 41db413bea
34 changed files with 783 additions and 208 deletions
@@ -0,0 +1,23 @@
import { GQLCloseCommentingTypeResolver } from "talk-server/graph/tenant/schema/__generated__/types";
import * as settings from "talk-server/models/settings";
import { translate } from "talk-server/services/i18n";
export const CloseCommenting: GQLCloseCommentingTypeResolver<
settings.CloseCommenting
> = {
message: (closeCommenting, input, ctx) => {
if (closeCommenting.message) {
return closeCommenting.message;
}
// Get the translation bundle.
const bundle = ctx.i18n.getBundle(ctx.lang);
// Translate the default close message.
return translate(
bundle,
"Comments are closed on this story.",
"closeCommentingDefaultMessage"
);
},
};
@@ -0,0 +1,23 @@
import { GQLDisableCommentingTypeResolver } from "talk-server/graph/tenant/schema/__generated__/types";
import * as settings from "talk-server/models/settings";
import { translate } from "talk-server/services/i18n";
export const DisableCommenting: GQLDisableCommentingTypeResolver<
settings.DisableCommenting
> = {
message: (disableCommenting, input, ctx) => {
if (disableCommenting.message) {
return disableCommenting.message;
}
// Get the translation bundle.
const bundle = ctx.i18n.getBundle(ctx.lang);
// Translate the default close message.
return translate(
bundle,
"Comments are closed on this story.",
"disableCommentingDefaultMessage"
);
},
};
@@ -4,10 +4,12 @@ import { GQLResolver } from "talk-server/graph/tenant/schema/__generated__/types
import { AcceptCommentPayload } from "./AcceptCommentPayload";
import { AuthIntegrations } from "./AuthIntegrations";
import { CloseCommenting } from "./CloseCommenting";
import { Comment } from "./Comment";
import { CommentCounts } from "./CommentCounts";
import { CommentModerationAction } from "./CommentModerationAction";
import { CommentRevision } from "./CommentRevision";
import { DisableCommenting } from "./DisableCommenting";
import { FacebookAuthIntegration } from "./FacebookAuthIntegration";
import { GoogleAuthIntegration } from "./GoogleAuthIntegration";
import { ModerationQueue } from "./ModerationQueue";
@@ -24,11 +26,13 @@ import { User } from "./User";
const Resolvers: GQLResolver = {
AcceptCommentPayload,
AuthIntegrations,
CloseCommenting,
Comment,
CommentCounts,
CommentModerationAction,
CommentRevision,
Cursor,
DisableCommenting,
FacebookAuthIntegration,
GoogleAuthIntegration,
ModerationQueue,
@@ -780,7 +780,7 @@ type DisableCommenting {
message will be shown above the comment stream while
commenting is disabled site-wide.
"""
message: String
message: String!
}
################################################################################
@@ -912,7 +912,7 @@ type CloseCommenting {
message when provided will be the message that shows when the comment stream
is closed for commenting.
"""
message: String
message: String!
}
"""