mirror of
https://github.com/wassname/talk.git
synced 2026-09-10 12:43:11 +08:00
[CORL-1155] Fix theming for rebranded stream/admin (#3012)
* Repair theming and CSS variables for the rebrand This separates the CSS variables into three sections for admin, stream, as well as a shared set between them. This also adds injection of the raw colours from the design team into post css variables. Lastly, this re-maps the existing theme variables to a new consolidated set with fallbacks for compatibility. Since this is a singular commit from various WIP commits, I am crediting @cvle as well as myself for this work. Thank you all who helped make this rebrand with theming possible! CORL-1155 Co-authored-by: Chi Vinh Le <vinh@vinh.tech> * Convert old css variables in CallOut * Rename postive/negative => success/error CORL-1155 * Change some CSS Variable names * fix TextField/PasswordField colors Co-authored-by: Chi Vinh Le <vinh@vinh.tech>
This commit is contained in:
@@ -8,7 +8,6 @@ import {
|
||||
UserForbiddenError,
|
||||
UserNotFoundError,
|
||||
} from "coral-server/errors";
|
||||
import { GQLUSER_ROLE } from "coral-server/graph/schema/__generated__/types";
|
||||
import { retrieveUser, User } from "coral-server/models/user";
|
||||
import { decodeJWT, extractTokenFromRequest } from "coral-server/services/jwt";
|
||||
import {
|
||||
@@ -18,6 +17,8 @@ import {
|
||||
} from "coral-server/services/users/auth/confirm";
|
||||
import { RequestHandler } from "coral-server/types/express";
|
||||
|
||||
import { GQLUSER_ROLE } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export type ConfirmRequestOptions = Pick<
|
||||
AppOptions,
|
||||
"mongo" | "mailerQueue" | "signingConfig" | "redis" | "config"
|
||||
|
||||
@@ -2,7 +2,6 @@ import Joi from "@hapi/joi";
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
import { LanguageCode, LOCALES } from "coral-common/helpers/i18n/locales";
|
||||
|
||||
import { AppOptions } from "coral-server/app";
|
||||
import { validate } from "coral-server/app/request/body";
|
||||
import { RequestLimiter } from "coral-server/app/request/limiter";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { revision, version } from "coral-common/version";
|
||||
import { RequestHandler } from "express";
|
||||
|
||||
import { revision, version } from "coral-common/version";
|
||||
|
||||
export const versionHandler: RequestHandler = (req, res, next) => {
|
||||
res.json({ version, revision });
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import logger from "coral-server/logger";
|
||||
import fs from "fs";
|
||||
|
||||
import logger from "coral-server/logger";
|
||||
|
||||
export interface Asset {
|
||||
src: string;
|
||||
integrity: string;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { GraphQLExtension, GraphQLOptions } from "apollo-server-express";
|
||||
import { Handler } from "express";
|
||||
import { FieldDefinitionNode, GraphQLError, ValidationContext } from "graphql";
|
||||
|
||||
// TODO: when https://github.com/apollographql/apollo-server/pull/1907 is merged, update this import path
|
||||
import {
|
||||
ExpressGraphQLOptionsFunction,
|
||||
graphqlExpress,
|
||||
} from "apollo-server-express/dist/expressApollo";
|
||||
import { Handler } from "express";
|
||||
import { FieldDefinitionNode, GraphQLError, ValidationContext } from "graphql";
|
||||
|
||||
import { Config } from "coral-server/config";
|
||||
import {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { AppOptions } from "coral-server/app";
|
||||
import { RawQueryNotAuthorized } from "coral-server/errors";
|
||||
import { getPersistedQuery } from "coral-server/graph/persisted";
|
||||
import { GQLUSER_ROLE } from "coral-server/graph/schema/__generated__/types";
|
||||
import { RequestHandler } from "coral-server/types/express";
|
||||
|
||||
import { GQLUSER_ROLE } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
type PersistedQueryMiddlewareOptions = Pick<
|
||||
AppOptions,
|
||||
"persistedQueryCache" | "persistedQueriesRequired"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Joi from "@hapi/joi";
|
||||
import { Redis } from "ioredis";
|
||||
import { Db } from "mongodb";
|
||||
import { Strategy as LocalStrategy } from "passport-local";
|
||||
|
||||
@@ -11,7 +12,6 @@ import {
|
||||
verifyUserPassword,
|
||||
} from "coral-server/models/user";
|
||||
import { Request } from "coral-server/types/express";
|
||||
import { Redis } from "ioredis";
|
||||
|
||||
const verifyFactory = (
|
||||
mongo: Db,
|
||||
|
||||
@@ -2,7 +2,6 @@ import express, { Router } from "express";
|
||||
|
||||
import { LanguageCode } from "coral-common/helpers/i18n/locales";
|
||||
import { AppOptions } from "coral-server/app";
|
||||
|
||||
import playground from "coral-server/app/middleware/playground";
|
||||
import { RouterOptions } from "coral-server/app/router/types";
|
||||
import logger from "coral-server/logger";
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Request } from "express";
|
||||
|
||||
import {
|
||||
doesRequireSchemePrefixing,
|
||||
extractParentsOrigin,
|
||||
prefixSchemeIfRequired,
|
||||
} from "coral-server/app/url";
|
||||
import { Request } from "express";
|
||||
|
||||
it("extracts the url when the parentUrl is not provided", () => {
|
||||
const req = { headers: {}, query: {} } as Request;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { URL } from "url";
|
||||
|
||||
import { Config } from "coral-server/config";
|
||||
import { Tenant } from "coral-server/models/tenant";
|
||||
import { Request } from "coral-server/types/express";
|
||||
import { URL } from "url";
|
||||
|
||||
export function reconstructURL(req: Request, path = "/"): string {
|
||||
const scheme = req.secure ? "https" : "http";
|
||||
|
||||
@@ -2,13 +2,14 @@ import { Db } from "mongodb";
|
||||
import path from "path";
|
||||
|
||||
import { Config } from "coral-server/config";
|
||||
import { GQLDIGEST_FREQUENCY } from "coral-server/graph/schema/__generated__/types";
|
||||
import { MailerQueue } from "coral-server/queue/tasks/mailer";
|
||||
import { DigestibleTemplate } from "coral-server/queue/tasks/mailer/templates";
|
||||
import { JWTSigningConfig } from "coral-server/services/jwt";
|
||||
import NotificationContext from "coral-server/services/notifications/context";
|
||||
import { TenantCache } from "coral-server/services/tenant/cache";
|
||||
|
||||
import { GQLDIGEST_FREQUENCY } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
import {
|
||||
ScheduledJob,
|
||||
ScheduledJobCommand,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { VError } from "verror";
|
||||
|
||||
import { CoralError, DuplicateUserError, WrappedInternalError } from ".";
|
||||
import { CoralError, DuplicateUserError, WrappedInternalError } from "./";
|
||||
|
||||
it("has the right inheritance chain", () => {
|
||||
const err = new DuplicateUserError();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import logger from "coral-server/logger";
|
||||
import { createFetch } from "coral-server/services/fetch";
|
||||
|
||||
import SlackPublishEvent, { Trigger } from "./publishEvent";
|
||||
import { GQLMODERATION_QUEUE } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
import {
|
||||
CommentCreatedCoralEventPayload,
|
||||
@@ -13,8 +13,8 @@ import {
|
||||
CoralEventPublisherFactory,
|
||||
} from "../../publisher";
|
||||
import { CoralEventType } from "../../types";
|
||||
import SlackPublishEvent, { Trigger } from "./publishEvent";
|
||||
|
||||
import { GQLMODERATION_QUEUE } from "coral-server/graph/schema/__generated__/types";
|
||||
type SlackCoralEventListenerPayloads =
|
||||
| CommentFeaturedCoralEventPayload
|
||||
| CommentEnteredModerationQueueCoralEventPayload
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
WrappedInternalError,
|
||||
} from "coral-server/errors";
|
||||
import GraphContext from "coral-server/graph/context";
|
||||
|
||||
import { getOriginalError } from "./helpers";
|
||||
|
||||
function hoistCoralErrorExtensions(
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { defaultTo } from "lodash";
|
||||
|
||||
import GraphContext from "coral-server/graph/context";
|
||||
import { retrieveCommentModerationActionConnection } from "coral-server/models/action/moderation/comment";
|
||||
|
||||
import {
|
||||
CommentToStatusHistoryArgs,
|
||||
UserToCommentModerationActionHistoryArgs,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { retrieveCommentModerationActionConnection } from "coral-server/models/action/moderation/comment";
|
||||
|
||||
export default (ctx: GraphContext) => ({
|
||||
forModerator: (
|
||||
|
||||
@@ -2,11 +2,6 @@ import DataLoader from "dataloader";
|
||||
import { defaultTo } from "lodash";
|
||||
|
||||
import Context from "coral-server/graph/context";
|
||||
import {
|
||||
GQLUSER_ROLE,
|
||||
GQLUSER_STATUS,
|
||||
QueryToUsersArgs,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { Connection } from "coral-server/models/helpers";
|
||||
import {
|
||||
retrieveManyUsers,
|
||||
@@ -15,6 +10,12 @@ import {
|
||||
UserConnectionInput,
|
||||
} from "coral-server/models/user";
|
||||
|
||||
import {
|
||||
GQLUSER_ROLE,
|
||||
GQLUSER_STATUS,
|
||||
QueryToUsersArgs,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
type UserConnectionFilterInput = UserConnectionInput["filter"];
|
||||
|
||||
const roleFilter = (role?: GQLUSER_ROLE): UserConnectionFilterInput => {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import TenantContext from "coral-server/graph/context";
|
||||
import { Site } from "coral-server/models/site";
|
||||
import { create, update } from "coral-server/services/sites";
|
||||
|
||||
import {
|
||||
GQLCreateSiteInput,
|
||||
GQLUpdateSiteInput,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { Site } from "coral-server/models/site";
|
||||
import { create, update } from "coral-server/services/sites";
|
||||
|
||||
export const Sites = (ctx: TenantContext) => ({
|
||||
create: async (input: GQLCreateSiteInput): Promise<Readonly<Site> | null> =>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLBanStatusTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLBanStatusTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export type BanStatusInput = user.ConsolidatedBanStatus & {
|
||||
userID: string;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLBanStatusHistoryTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLBanStatusHistoryTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const BanStatusHistory: Required<GQLBanStatusHistoryTypeResolver<
|
||||
user.BanStatusHistory
|
||||
>> = {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { GQLCloseCommentingTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as settings from "coral-server/models/settings";
|
||||
import { translate } from "coral-server/services/i18n";
|
||||
|
||||
import { GQLCloseCommentingTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const CloseCommenting: GQLCloseCommentingTypeResolver<settings.CloseCommenting> = {
|
||||
message: (closeCommenting, input, ctx) => {
|
||||
if (closeCommenting.message) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { GQLCommentRevisionTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import { decodeActionCounts } from "coral-server/models/action/comment";
|
||||
import { Comment, Revision } from "coral-server/models/comment";
|
||||
|
||||
import { GQLCommentRevisionTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export interface WrappedCommentRevision {
|
||||
revision: Revision;
|
||||
comment: Comment;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { GQLDisableCommentingTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as settings from "coral-server/models/settings";
|
||||
import { translate } from "coral-server/services/i18n";
|
||||
|
||||
import { GQLDisableCommentingTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const DisableCommenting: GQLDisableCommentingTypeResolver<settings.DisableCommenting> = {
|
||||
message: (disableCommenting, input, ctx) => {
|
||||
if (disableCommenting.message) {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import * as actions from "coral-server/models/action/comment";
|
||||
|
||||
import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLFlagTypeResolver,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import * as actions from "coral-server/models/action/comment";
|
||||
|
||||
export const Flag: GQLFlagTypeResolver<actions.CommentAction> = {
|
||||
reason: ({ id, reason }, args, ctx) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLInviteTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as invite from "coral-server/models/invite";
|
||||
|
||||
import { GQLInviteTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const Invite: GQLInviteTypeResolver<invite.Invite> = {
|
||||
createdBy: ({ createdBy }, args, ctx) =>
|
||||
ctx.loaders.Users.user.load(createdBy),
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
CommentConnectionInput,
|
||||
retrieveCommentConnection,
|
||||
} from "coral-server/models/comment";
|
||||
|
||||
import {
|
||||
GQLCOMMENT_SORT,
|
||||
GQLModerationQueueTypeResolver,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLModeratorNoteTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLModeratorNoteTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const ModeratorNote: Required<GQLModeratorNoteTypeResolver<
|
||||
user.ModeratorNote
|
||||
>> = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLPremodStatusTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLPremodStatusTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export type PremodStatusInput = user.ConsolidatedPremodStatus & {
|
||||
userID: string;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLPremodStatusHistoryTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLPremodStatusHistoryTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const PremodStatusHistory: Required<GQLPremodStatusHistoryTypeResolver<
|
||||
user.PremodStatusHistory
|
||||
>> = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLProfileTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLProfileTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
const resolveType: GQLProfileTypeResolver<user.Profile> = (profile) => {
|
||||
switch (profile.type) {
|
||||
case "local":
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLSuspensionStatusTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLSuspensionStatusTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export type SuspensionStatusInput = user.ConsolidatedSuspensionStatus & {
|
||||
userID: string;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLSuspensionStatusHistoryTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLSuspensionStatusHistoryTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const SuspensionStatusHistory: Required<GQLSuspensionStatusHistoryTypeResolver<
|
||||
user.SuspensionStatusHistory
|
||||
>> = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLTagTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import { CommentTag } from "coral-server/models/comment/tag";
|
||||
|
||||
import { GQLTagTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const Tag: GQLTagTypeResolver<CommentTag> = {
|
||||
code: ({ type }) => type,
|
||||
createdBy: ({ createdBy }, input, ctx) => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import {
|
||||
GQLUSER_STATUS,
|
||||
GQLUserStatusTypeResolver,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { BanStatusInput } from "./BanStatus";
|
||||
import { PremodStatusInput } from "./PremodStatus";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLUsernameHistoryTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLUsernameHistoryTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const UsernameHistory: Required<GQLUsernameHistoryTypeResolver<
|
||||
user.UsernameHistory
|
||||
>> = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GQLUsernameStatusTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
import * as user from "coral-server/models/user";
|
||||
|
||||
import { GQLUsernameStatusTypeResolver } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export type UsernameStatusInput = user.ConsolidatedUsernameStatus & {
|
||||
userID: string;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { LOCALES } from "coral-common/helpers/i18n";
|
||||
import { GraphQLScalarType } from "graphql";
|
||||
import { Kind } from "graphql/language";
|
||||
|
||||
import { LOCALES } from "coral-common/helpers/i18n";
|
||||
|
||||
function assertSupportLocale(locale: string) {
|
||||
if (!LOCALES.includes(locale as any)) {
|
||||
throw new Error(`Supported locales are ${JSON.stringify(LOCALES)}`);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { stdSerializers } from "bunyan";
|
||||
import { GraphQLError } from "graphql";
|
||||
import StackUtils from "stack-utils";
|
||||
import VError from "verror";
|
||||
|
||||
import { CoralError, CoralErrorContext } from "coral-server/errors";
|
||||
import VError from "verror";
|
||||
|
||||
interface SerializedError {
|
||||
id?: string;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import PrettyStream from "@coralproject/bunyan-prettystream";
|
||||
|
||||
import config from "coral-server/config";
|
||||
|
||||
import PrettyStream from "@coralproject/bunyan-prettystream";
|
||||
import { SecretStream } from "./SecretStream";
|
||||
|
||||
export function getStreams() {
|
||||
|
||||
@@ -4,15 +4,6 @@ import { Db } from "mongodb";
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
import { Sub } from "coral-common/types";
|
||||
import {
|
||||
GQLActionPresence,
|
||||
GQLCOMMENT_FLAG_DETECTED_REASON,
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_FLAG_REPORTED_REASON,
|
||||
GQLDontAgreeActionCounts,
|
||||
GQLFlagActionCounts,
|
||||
GQLReactionActionCounts,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import logger from "coral-server/logger";
|
||||
import {
|
||||
Connection,
|
||||
@@ -24,6 +15,16 @@ import {
|
||||
import { TenantResource } from "coral-server/models/tenant";
|
||||
import { commentActions as collection } from "coral-server/services/mongodb/collections";
|
||||
|
||||
import {
|
||||
GQLActionPresence,
|
||||
GQLCOMMENT_FLAG_DETECTED_REASON,
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_FLAG_REPORTED_REASON,
|
||||
GQLDontAgreeActionCounts,
|
||||
GQLFlagActionCounts,
|
||||
GQLReactionActionCounts,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export enum ACTION_TYPE {
|
||||
/**
|
||||
* REACTION corresponds to a reaction to a comment from a user.
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Db } from "mongodb";
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
import { Sub } from "coral-common/types";
|
||||
import { GQLCOMMENT_STATUS } from "coral-server/graph/schema/__generated__/types";
|
||||
import {
|
||||
Connection,
|
||||
ConnectionInput,
|
||||
@@ -12,6 +11,8 @@ import {
|
||||
import { TenantResource } from "coral-server/models/tenant";
|
||||
import { commentModerationActions as collection } from "coral-server/services/mongodb/collections";
|
||||
|
||||
import { GQLCOMMENT_STATUS } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
/**
|
||||
* CommentModerationAction stores information around a moderation action that
|
||||
* was created for a given Comment Revision.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { isUndefined, omitBy } from "lodash";
|
||||
|
||||
import { Collection, Cursor, FilterQuery as MongoFilterQuery } from "mongodb";
|
||||
|
||||
import { Writable } from "coral-common/types";
|
||||
|
||||
@@ -2,10 +2,11 @@ import { Db } from "mongodb";
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
import { Sub } from "coral-common/types";
|
||||
import { GQLUSER_ROLE } from "coral-server/graph/schema/__generated__/types";
|
||||
import { TenantResource } from "coral-server/models/tenant";
|
||||
import { invites as collection } from "coral-server/services/mongodb/collections";
|
||||
|
||||
import { GQLUSER_ROLE } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export interface Invite extends TenantResource {
|
||||
readonly id: string;
|
||||
email: string;
|
||||
|
||||
@@ -3,12 +3,12 @@ import nunjucks, { Environment, ILoader } from "nunjucks";
|
||||
import path from "path";
|
||||
|
||||
import { Config } from "coral-server/config";
|
||||
import { Tenant } from "coral-server/models/tenant";
|
||||
import {
|
||||
TenantCache,
|
||||
TenantCacheAdapter,
|
||||
} from "coral-server/services/tenant/cache";
|
||||
|
||||
import { Tenant } from "coral-server/models/tenant";
|
||||
import { EmailTemplate } from "./templates";
|
||||
|
||||
// templateDirectory is the directory containing the email templates.
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
} from "coral-server/stacks/helpers";
|
||||
|
||||
import { GQLCOMMENT_FLAG_REPORTED_REASON } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
import {
|
||||
publishCommentFlagCreated,
|
||||
publishCommentReactionCreated,
|
||||
|
||||
@@ -2,7 +2,6 @@ import { DateTime } from "luxon";
|
||||
import { Db } from "mongodb";
|
||||
|
||||
import { CommentNotFoundError } from "coral-server/errors";
|
||||
import { GQLTAG } from "coral-server/graph/schema/__generated__/types";
|
||||
import {
|
||||
addCommentTag,
|
||||
removeCommentTag,
|
||||
@@ -12,6 +11,8 @@ import { getLatestRevision } from "coral-server/models/comment/helpers";
|
||||
import { Tenant } from "coral-server/models/tenant";
|
||||
import { User } from "coral-server/models/user";
|
||||
|
||||
import { GQLTAG } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
/**
|
||||
* getCommentEditableUntilDate will return the date that the given comment is
|
||||
* still editable until.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { GQLCOMMENT_STATUS } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
import { calculateCountsDiff } from "./counts";
|
||||
|
||||
it("allows transition from NONE to APPROVED", () => {
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import { DeepPartial } from "coral-common/types";
|
||||
import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "coral-server/models/action/comment";
|
||||
import { RevisionMetadata } from "coral-server/models/comment";
|
||||
import { GlobalModerationSettings } from "coral-server/models/settings";
|
||||
@@ -11,6 +7,11 @@ import {
|
||||
IntermediatePhaseResult,
|
||||
} from "coral-server/services/comments/pipeline";
|
||||
|
||||
import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
const testPremodLinksEnable = (
|
||||
settings: DeepPartial<GlobalModerationSettings>,
|
||||
metadata: RevisionMetadata
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { DeepPartial } from "coral-common/types";
|
||||
import {
|
||||
GQLCOMMENT_STATUS,
|
||||
GQLMODERATION_MODE,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { GlobalModerationSettings } from "coral-server/models/settings";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
IntermediatePhaseResult,
|
||||
} from "coral-server/services/comments/pipeline";
|
||||
|
||||
import {
|
||||
GQLCOMMENT_STATUS,
|
||||
GQLMODERATION_MODE,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
const testModerationMode = (settings: DeepPartial<GlobalModerationSettings>) =>
|
||||
settings.moderation === GQLMODERATION_MODE.PRE;
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { GQLCOMMENT_STATUS } from "coral-server/graph/schema/__generated__/types";
|
||||
import {
|
||||
IntermediateModerationPhase,
|
||||
IntermediatePhaseResult,
|
||||
} from "coral-server/services/comments/pipeline";
|
||||
|
||||
import { GQLCOMMENT_STATUS } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
// If a given user is set to always premod, set to premod.
|
||||
export const premodUser: IntermediateModerationPhase = ({
|
||||
author,
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "coral-server/models/action/comment";
|
||||
import {
|
||||
IntermediatePhaseResult,
|
||||
ModerationPhaseContext,
|
||||
} from "coral-server/services/comments/pipeline";
|
||||
|
||||
import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const premodNewCommenter = async ({
|
||||
tenant,
|
||||
author,
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "coral-server/models/action/comment";
|
||||
import {
|
||||
calculateRejectionRate,
|
||||
@@ -14,6 +10,11 @@ import {
|
||||
ModerationPhaseContext,
|
||||
} from "coral-server/services/comments/pipeline";
|
||||
|
||||
import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
export const recentCommentHistory = async ({
|
||||
tenant,
|
||||
author,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
import { storyClosed } from "coral-server/services/comments/pipeline/phases/storyClosed";
|
||||
import { ModerationPhaseContext } from "..";
|
||||
|
||||
import { ModerationPhaseContext } from "../";
|
||||
|
||||
describe("storyClosed", () => {
|
||||
it("throws an error when the story is closed", () => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { ACTION_TYPE } from "coral-server/models/action/comment";
|
||||
|
||||
import {
|
||||
GQLCOMMENT_FLAG_REASON,
|
||||
GQLCOMMENT_STATUS,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { ACTION_TYPE } from "coral-server/models/action/comment";
|
||||
|
||||
import { compose, ModerationPhaseContext } from "./pipeline";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { I18n } from ".";
|
||||
import { I18n } from "./";
|
||||
|
||||
it("loads the translations without error", async () => {
|
||||
const translation = new I18n("en-US");
|
||||
|
||||
@@ -7,7 +7,6 @@ import { Bearer, BearerOptions } from "permit";
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
import { DEFAULT_SESSION_DURATION } from "coral-common/constants";
|
||||
|
||||
import {
|
||||
AuthenticationError,
|
||||
JWTRevokedError,
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Db } from "mongodb";
|
||||
// Use the following collections reference to interact with specific
|
||||
// collections.
|
||||
// import collections from "coral-server/services/mongodb/collections";
|
||||
|
||||
import Migration from "coral-server/services/migrate/migration";
|
||||
|
||||
export default class extends Migration {
|
||||
|
||||
@@ -2,7 +2,6 @@ import DataLoader from "dataloader";
|
||||
import { Db } from "mongodb";
|
||||
|
||||
import { Config } from "coral-server/config";
|
||||
import { GQLDIGEST_FREQUENCY } from "coral-server/graph/schema/__generated__/types";
|
||||
import logger, { Logger } from "coral-server/logger";
|
||||
import { Comment, retrieveManyComments } from "coral-server/models/comment";
|
||||
import { retrieveManyStories, Story } from "coral-server/models/story";
|
||||
@@ -16,6 +15,8 @@ import {
|
||||
import { DigestibleTemplate } from "coral-server/queue/tasks/mailer/templates";
|
||||
import { JWTSigningConfig } from "coral-server/services/jwt";
|
||||
|
||||
import { GQLDIGEST_FREQUENCY } from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
import { generateUnsubscribeURL } from "./categories/unsubscribe";
|
||||
|
||||
interface Options {
|
||||
|
||||
@@ -4,6 +4,8 @@ import { DateTime } from "luxon";
|
||||
import { Db } from "mongodb";
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
import { constructTenantURL } from "coral-server/app/url";
|
||||
import { Config } from "coral-server/config";
|
||||
import {
|
||||
LocalProfileNotSetError,
|
||||
PasswordResetTokenExpired,
|
||||
@@ -26,8 +28,6 @@ import {
|
||||
verifyJWT,
|
||||
} from "coral-server/services/jwt";
|
||||
|
||||
import { constructTenantURL } from "coral-server/app/url";
|
||||
import { Config } from "coral-server/config";
|
||||
import { validatePassword } from "../helpers";
|
||||
|
||||
export interface ResetToken extends Required<StandardClaims> {
|
||||
|
||||
Reference in New Issue
Block a user