[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
@@ -4,19 +4,27 @@ import { Environment } from "relay-runtime";
import { createFetchContainer, fetchQuery } from "talk-framework/lib/relay";
import { RefreshSettingsQuery as QueryTypes } from "talk-stream/__generated__/RefreshSettingsQuery.graphql";
export type RefreshSettingsVariables = QueryTypes["variables"];
const query = graphql`
query RefreshSettingsQuery {
query RefreshSettingsQuery($storyID: ID!) {
settings {
...StreamContainer_settings
}
# We also refrech story props that are
# dependent on the settings.
story(id: $storyID) {
closedAt
isClosed
}
}
`;
function fetch(environment: Environment) {
function fetch(environment: Environment, variables: RefreshSettingsVariables) {
return fetchQuery<QueryTypes["response"]["settings"]>(
environment,
query,
{},
variables,
{ force: true }
);
}
@@ -26,6 +34,6 @@ export const withRefreshSettingsFetch = createFetchContainer(
fetch
);
export type RefreshSettingsFetch = () => Promise<
QueryTypes["response"]["settings"]
>;
export type RefreshSettingsFetch = (
variables: RefreshSettingsVariables
) => Promise<QueryTypes["response"]["settings"]>;