mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
[CORL-159, CORL-160] Stream Config Tab (#2219)
* feat: Implement stream configuration tab * feat: split profile & configure into separate bundles * chore: better role logic * fix+chore: add test cases, implement expectAndFail, refactor tests * chore: add some comments * chore: Update src/core/client/framework/lib/form/helpers.tsx Co-Authored-By: cvle <vinh@wikiwi.io> * feat: support new graphql mutations/schema * fix: ci fixes * fix: improvement to revision loading * fix: updated some tests * fix: adapt client to changes * fix: remove obsolote isClosed in UpdateStory * ci: increase no_output_timeout for build
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
RecordSourceSelectorProxy,
|
||||
} from "relay-runtime";
|
||||
|
||||
import { getMe } from "talk-framework/helpers";
|
||||
import { getMe, getStorySettings } from "talk-framework/helpers";
|
||||
import { TalkContext } from "talk-framework/lib/bootstrap";
|
||||
import {
|
||||
commitMutationPromiseNormalized,
|
||||
@@ -18,9 +18,9 @@ import { CreateCommentReplyMutation as MutationTypes } from "talk-stream/__gener
|
||||
|
||||
import {
|
||||
incrementStoryCommentCounts,
|
||||
isRolePriviledged,
|
||||
isVisible,
|
||||
prependCommentEdgeToProfile,
|
||||
roleIsAtLeast,
|
||||
} from "../helpers";
|
||||
|
||||
export type CreateCommentReplyInput = MutationInput<MutationTypes> & {
|
||||
@@ -102,7 +102,9 @@ function addLocalCommentReplyToStory(
|
||||
// tslint:disable-next-line:no-unused-expression
|
||||
graphql`
|
||||
fragment CreateCommentReplyMutation_story on Story {
|
||||
moderation
|
||||
settings {
|
||||
moderation
|
||||
}
|
||||
}
|
||||
fragment CreateCommentReplyMutation_me on User {
|
||||
role
|
||||
@@ -135,17 +137,14 @@ function commit(
|
||||
const currentDate = new Date().toISOString();
|
||||
const id = uuidGenerator();
|
||||
|
||||
const story = relayEnvironment
|
||||
.getStore()
|
||||
.getSource()
|
||||
.get(input.storyID);
|
||||
if (!story || !story.moderation) {
|
||||
const storySettings = getStorySettings(relayEnvironment, input.storyID);
|
||||
if (!storySettings || !storySettings.moderation) {
|
||||
throw new Error("Moderation mode of the story was not included");
|
||||
}
|
||||
|
||||
// TODO: Generate and use schema types.
|
||||
const expectPremoderation =
|
||||
!isRolePriviledged(me.role) && story.moderation === "PRE";
|
||||
!roleIsAtLeast(me.role, "STAFF") && storySettings.moderation === "PRE";
|
||||
|
||||
return commitMutationPromiseNormalized<MutationTypes>(environment, {
|
||||
mutation,
|
||||
|
||||
Reference in New Issue
Block a user