mirror of
https://github.com/wassname/talk.git
synced 2026-06-27 20:23:30 +08:00
065cb4b03a
* feat: Implement new Sign In view * feat: Move forgot + resetPassword to new design * feat: Implement sign up with new design * fix: narrow gutter * test: add unit tests * test: integration tests * feat: support show / hide password * feat: support oauth2 flow * feat: add views for user completion * feat: implement oauth2 sign up * test: fix snapshots * fix: lint * fix: get more complete mutation response * fix: removed array of OIDC integrations * fix: renamed resolver function * fix: adapt oidc client implementation * fix: targetFilter should be stream on signup * fix: removed unneeded message * fix: moved password into local profile * fix: made username optional, removed valid null value * fix: linting * fix: respect targetFilter * feat: support user registration mutations - Added `setUsername` - Added `setEmail` - Added `setPassword` - Added `permit` to `@auth` - Added `email` to `User` * fix: fixed issue with query * feat: added user password update * feat: complete sign in mutation * fix: adapt some rebasing gitches * test: improve tests * test: unittest for setting auth token * fix: failing tests * test: move most tests from enzyme to react-test-renderer * fix: remove schema warnings in tests * test: improve window mock * test: test different social login configurations * test: test social logins for sign up * fix: use htmlFor instead of for * test: more feature tests * feat: always go through account completion * test: feature test account completion * feat: addtional account completion test * Update start.ts * chore: refactor auth token retrieval logic
267 lines
5.9 KiB
TypeScript
267 lines
5.9 KiB
TypeScript
import { merge } from "lodash";
|
|
|
|
export const settings = {
|
|
id: "settings",
|
|
wordList: {
|
|
banned: [],
|
|
suspect: [],
|
|
},
|
|
auth: {
|
|
displayName: {
|
|
enabled: false,
|
|
},
|
|
integrations: {
|
|
local: {
|
|
enabled: true,
|
|
allowRegistration: true,
|
|
targetFilter: {
|
|
admin: true,
|
|
stream: true,
|
|
},
|
|
},
|
|
sso: {
|
|
enabled: false,
|
|
allowRegistration: true,
|
|
targetFilter: {
|
|
admin: true,
|
|
stream: true,
|
|
},
|
|
key: null,
|
|
keyGeneratedAt: null,
|
|
},
|
|
google: {
|
|
enabled: false,
|
|
allowRegistration: true,
|
|
targetFilter: {
|
|
admin: true,
|
|
stream: true,
|
|
},
|
|
clientID: "",
|
|
clientSecret: "",
|
|
callbackURL: "http://localhost/google/callback",
|
|
},
|
|
facebook: {
|
|
enabled: false,
|
|
allowRegistration: true,
|
|
targetFilter: {
|
|
admin: true,
|
|
stream: true,
|
|
},
|
|
clientID: "",
|
|
clientSecret: "",
|
|
callbackURL: "http://localhost/facebook/callback",
|
|
},
|
|
oidc: {
|
|
enabled: false,
|
|
allowRegistration: false,
|
|
targetFilter: {
|
|
admin: true,
|
|
stream: true,
|
|
},
|
|
callbackURL: "http://localhost/oidc/callback",
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
export const moderationActions = [
|
|
{
|
|
id: "07e8f815-e165-4b5d-b438-7163415c8cf7",
|
|
revision: {
|
|
id: "4210dc8b-c212-4f74-9381-913e8c52e51a",
|
|
comment: {
|
|
author: {
|
|
username: "luke2",
|
|
id: "4383c3d3-bb9b-40b9-847a-240f3cf6c6af",
|
|
},
|
|
id: "1b41be9f-510f-41f3-a1df-5a431dc98bf3",
|
|
},
|
|
},
|
|
createdAt: "2018-11-29T16:01:51.897Z",
|
|
status: "ACCEPTED",
|
|
__typename: "CommentModerationAction",
|
|
},
|
|
{
|
|
id: "6869314b-47ef-4cf9-b8ce-42b12bca8231",
|
|
revision: {
|
|
id: "4210dc8b-c212-4f74-9381-913e8c52e51a",
|
|
comment: {
|
|
author: {
|
|
username: "addy",
|
|
id: "4383c3d3-bb9b-40b9-847a-240f3cf6c6af",
|
|
},
|
|
id: "1b41be9f-510f-41f3-a1df-5a431dc98bf3",
|
|
},
|
|
},
|
|
createdAt: "2018-11-29T16:01:45.644Z",
|
|
status: "REJECTED",
|
|
__typename: "CommentModerationAction",
|
|
},
|
|
{
|
|
id: "caebbf7f-4813-42c0-ac3c-46b1be8199e0",
|
|
revision: {
|
|
id: "4210dc8b-c212-4f74-9381-913e8c52e51a",
|
|
comment: {
|
|
author: {
|
|
username: "dany",
|
|
id: "4383c3d3-bb9b-40b9-847a-240f3cf6c6af",
|
|
},
|
|
id: "1b41be9f-510f-41f3-a1df-5a431dc98bf3",
|
|
},
|
|
},
|
|
createdAt: "2018-11-29T16:01:42.060Z",
|
|
status: "ACCEPTED",
|
|
__typename: "CommentModerationAction",
|
|
},
|
|
{
|
|
id: "b2f92717-e4a8-4075-a543-95f7c5eaefb2",
|
|
revision: {
|
|
id: "4210dc8b-c212-4f74-9381-913e8c52e51a",
|
|
comment: {
|
|
author: {
|
|
username: "admin",
|
|
id: "4383c3d3-bb9b-40b9-847a-240f3cf6c6af",
|
|
},
|
|
id: "1b41be9f-510f-41f3-a1df-5a431dc98bf3",
|
|
},
|
|
},
|
|
createdAt: "2018-11-29T16:01:34.539Z",
|
|
status: "REJECTED",
|
|
__typename: "CommentModerationAction",
|
|
},
|
|
{
|
|
id: "9fb2ff3c-7105-4357-99e1-36cdeea49c75",
|
|
revision: {
|
|
id: "4210dc8b-c212-4f74-9381-913e8c52e51a",
|
|
comment: {
|
|
author: {
|
|
username: "mod245",
|
|
id: "4383c3d3-bb9b-40b9-847a-240f3cf6c6af",
|
|
},
|
|
id: "1b41be9f-510f-41f3-a1df-5a431dc98bf3",
|
|
},
|
|
},
|
|
createdAt: "2018-11-29T16:01:30.648Z",
|
|
status: "ACCEPTED",
|
|
__typename: "CommentModerationAction",
|
|
},
|
|
];
|
|
|
|
export const users = [
|
|
{
|
|
id: "user-0",
|
|
username: "Markus",
|
|
},
|
|
{
|
|
id: "user-1",
|
|
username: "Lukas",
|
|
},
|
|
{
|
|
id: "user-2",
|
|
username: "Isabelle",
|
|
},
|
|
];
|
|
|
|
export const baseComment = {
|
|
author: users[0],
|
|
body: "Comment Body",
|
|
createdAt: "2018-07-06T18:24:00.000Z",
|
|
status: "NONE",
|
|
actionCounts: {
|
|
flag: {
|
|
reasons: {
|
|
COMMENT_DETECTED_TOXIC: 0,
|
|
COMMENT_DETECTED_SPAM: 0,
|
|
COMMENT_DETECTED_TRUST: 0,
|
|
COMMENT_DETECTED_LINKS: 0,
|
|
COMMENT_DETECTED_BANNED_WORD: 0,
|
|
COMMENT_DETECTED_SUSPECT_WORD: 0,
|
|
COMMENT_REPORTED_OFFENSIVE: 0,
|
|
COMMENT_REPORTED_SPAM: 0,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
export const reportedComments = [
|
|
merge({}, baseComment, {
|
|
id: "comment-0",
|
|
author: users[0],
|
|
revision: {
|
|
id: "comment-0-revision-0",
|
|
},
|
|
permalink: "http://localhost/comment/0",
|
|
body:
|
|
"This is the last random sentence I will be writing and I am going to stop mid-sent",
|
|
actionCounts: {
|
|
flag: {
|
|
reasons: {
|
|
COMMENT_REPORTED_SPAM: 2,
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
merge({}, baseComment, {
|
|
id: "comment-1",
|
|
revision: {
|
|
id: "comment-1-revision-1",
|
|
},
|
|
permalink: "http://localhost/comment/1",
|
|
author: users[1],
|
|
body: "Don't fool with me",
|
|
actionCounts: {
|
|
flag: {
|
|
reasons: {
|
|
COMMENT_REPORTED_OFFENSIVE: 3,
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
merge({}, baseComment, {
|
|
id: "comment-2",
|
|
revision: {
|
|
id: "comment-2-revision-2",
|
|
},
|
|
permalink: "http://localhost/comment/2",
|
|
status: "PREMOD",
|
|
author: users[2],
|
|
body: "I think I deserve better",
|
|
actionCounts: {
|
|
flag: {
|
|
reasons: {
|
|
COMMENT_REPORTED_SPAM: 1,
|
|
COMMENT_REPORTED_OFFENSIVE: 1,
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
];
|
|
|
|
export const rejectedComments = reportedComments.map(c => ({
|
|
...c,
|
|
status: "REJECTED",
|
|
}));
|
|
|
|
export const emptyModerationQueues = {
|
|
reported: {
|
|
id: "reported",
|
|
count: 0,
|
|
comments: { edges: [], pageInfo: { endCursor: null, hasNextPage: false } },
|
|
},
|
|
pending: {
|
|
id: "pending",
|
|
count: 0,
|
|
comments: { edges: [], pageInfo: { endCursor: null, hasNextPage: false } },
|
|
},
|
|
unmoderated: {
|
|
id: "unmoderated",
|
|
count: 0,
|
|
comments: { edges: [], pageInfo: { endCursor: null, hasNextPage: false } },
|
|
},
|
|
};
|
|
|
|
export const emptyRejectedComments = {
|
|
edges: [],
|
|
pageInfo: { endCursor: null, hasNextPage: false },
|
|
};
|