Skip to content

Commit

Permalink
Merge pull request #4253 from coralproject/develop
Browse files Browse the repository at this point in the history
v8.2.0
  • Loading branch information
tessalt authored May 25, 2023
2 parents 3ae9082 + 5c74a92 commit 5568504
Show file tree
Hide file tree
Showing 32 changed files with 807 additions and 195 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:

env:
IMAGE_REPOSITORY: 'gcr.io/the-coral-project/coral'
IMAGE_CACHE_REPOSITORY: 'coralproject/ci'
DOCKERHUB_USERNAME: 'coralproject'


jobs:
Expand All @@ -16,7 +18,10 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
uses: webfactory/[email protected]
with:
Expand All @@ -28,6 +33,12 @@ jobs:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Define SHORT_SHA with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
Expand Down Expand Up @@ -90,20 +101,24 @@ jobs:
# Build tag push the image after a merge to develop
-
name: Build, Tag, Push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
if: github.ref == 'refs/heads/develop'
with:
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:develop-latest
build-args: |
REVISION_HASH=${GITHUB_SHA}
cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-develop
cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-develop
# Build tag push the release candidate image when the branch name begins with release-
-
name: Build, Tag, Push RC
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
if: startsWith( github.ref, 'refs/heads/release-')
with:
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
build-args: |
REVISION_HASH=${GITHUB_SHA}
cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-release
cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-release
18 changes: 14 additions & 4 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
DOCKERHUB_USERNAME: 'coralproject'
GOOGLE_CLOUD_BUCKET: 'coral-cdn'
IMAGE_REPOSITORY: 'coralproject/talk'
IMAGE_CACHE_REPOSITORY: 'coralproject/ci'
SENTRY_ORG: 'voxmedia'
SENTRY_PROJECT: 'coral'

Expand All @@ -20,7 +21,10 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
uses: webfactory/[email protected]
with:
Expand Down Expand Up @@ -118,28 +122,34 @@ jobs:
echo "PATCH_TAG=${MAJOR}.${MINOR}.${PATCH}" >> $GITHUB_ENV
-
name: Build, Tag, Push Major Tag
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:${{ env.MAJOR_TAG }}
build-args: |
REVISION_HASH=${{ env.GITHUB_SHA }}
cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-major
cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-major
-
name: Build, Tag, Push Minor Tag
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:${{ env.MINOR_TAG }}
build-args: |
REVISION_HASH=${{ env.GITHUB_SHA }}
cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-minor
cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-minor
-
name: Build, Tag, Push Patch Tag
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:${{ env.PATCH_TAG }}
build-args: |
REVISION_HASH=${{ env.GITHUB_SHA }}
cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-patch
cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-patch
-
name: Deploy Static Assets to GCS Bucket
run: |
Expand Down
3 changes: 0 additions & 3 deletions docs/docs/migrate-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ Before you start the data migration process, make sure you have the following:
- a site ID for the new v7 coral instance (inspect the one record in the `sites` collection)
- a mongo instance with a replica of your v4 production data set
- a local machine or virtual machine with sufficient RAM and processing power to run `mongoexport` and `mongoimport` on your data set. In our experience, large data sets (10+ GB) will require a minimum of 16GB RAM and 8 cores.
<<<<<<< HEAD
- # _before_ you start the migration process, it is a good idea to create several test users (one commenter, one moderator, one admin). Following the data migration, attempt to log in and comment/moderate as these users to verify that account and login related data was migrated correctly, and that authentication has been configured correctly.
- _before_ you start the migration process, it is a good idea to create several test users (one commenter, one moderator, one admin). Following the data migration, attempt to log in and comment/moderate as these users to verify that account and login related data was migrated correctly, and that authentication has bee configured correctly.
> > > > > > > main

## 1. Obtain JSON files for v4 data

Expand Down
22 changes: 22 additions & 0 deletions importBlocker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"sources": [
{
"name": "client",
"directory": "src/core/client",
"blockedImports": [
"coral-server/"
],
"extensions": [ ".ts", ".tsx" ]
},
{
"name": "server",
"directory": "src/core/server",
"blockedImports": [
"coral-client/",
"coral-stream/",
"coral-framework/"
],
"extensions": [ ".ts" ]
}
]
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "8.1.0",
"version": "8.2.0",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down Expand Up @@ -51,6 +51,7 @@
"lint:graphql": "graphql-schema-linter src/core/server/graph/schema/schema.graphql",
"lint:scripts": "eslint 'scripts/**/*.{js,ts,tsx}'",
"lint:server": "eslint 'src/**/*.{js,ts,tsx}' --ignore-pattern 'src/core/client/**'",
"lint:imports": "ts-node --transpile-only ./scripts/importBlocker.ts",
"lint": "npm-run-all --parallel lint:* tscheck:*",
"migration:create": "ts-node --transpile-only ./scripts/migration/create.ts",
"start:development": "NODE_ENV=development TS_NODE_PROJECT=./src/tsconfig.json DISABLE_JOB_PROCESSORS=true ts-node-dev --inspect --transpile-only --no-notify -r tsconfig-paths/register --ignore-watch ./docs/ ./src/index.ts",
Expand Down
107 changes: 107 additions & 0 deletions scripts/importBlocker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/* eslint-disable no-console */

import fs from "fs";
import path from "path";
import readLine from "readline";

const CONFIG_FILE = "importBlocker.json";

interface Source {
name: string;
directory: string;
blockedImports: string[];
extensions: string[];
}

interface Config {
sources: Source[];
}

interface Error {
path: string;
lineNumber: number;
line: string;
}

const loadConfig = (): Config => {
const configRaw = fs.readFileSync(CONFIG_FILE).toString();
const config = JSON.parse(configRaw) as Config;

return config;
};

const errors: Error[] = [];

const processFile = async (
source: Source,
filePath: string,
filters: string[]
) => {
const stream = fs.createReadStream(filePath);
const reader = readLine.createInterface({
input: stream,
crlfDelay: Infinity,
});

let lineCounter = 0;
for await (const line of reader) {
for (const filter of filters) {
if (line.includes(filter)) {
errors.push({
path: filePath,
lineNumber: lineCounter,
line,
});
}
}

lineCounter++;
}
};

const processDir = async (source: Source, dir: string, filters: string[]) => {
const items = fs.readdirSync(dir);

for (const item of items) {
const fullPath = path.join(dir, item);
const stats = fs.lstatSync(fullPath);

if (stats.isDirectory()) {
await processDir(source, fullPath, filters);
} else if (stats.isFile()) {
const ext = path.extname(item);

if (source.extensions.includes(ext)) {
await processFile(source, fullPath, filters);
}
}
}
};

const run = async () => {
const config = loadConfig();

for (const source of config.sources) {
const filters = source.blockedImports.map(
(blockedImport) => `from "${blockedImport}`
);

await processDir(source, source.directory, filters);
}

if (errors.length > 0) {
console.error("Blocked imports linter found the following errors:");

for (const error of errors) {
console.error(
` Blocked import found in '${error.path}' on line ${error.lineNumber}: ${error.line}`
);
}

process.exit(1);
} else {
console.log("Blocked imports linter found 0 errors.");
}
};

run().finally(() => {});
22 changes: 21 additions & 1 deletion src/core/client/admin/components/BanModal.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ $ban-modal-text: var(--palette-text-500);
height: calc(12 * var(--mini-unit));
}

.sitesToggle {
.domainBanHeader {
margin-bottom: var(--spacing-2);
}

.form {
margin-bottom: var(--spacing-3);
}

.banFromHeader {
margin-bottom: var(--spacing-2);
}

.sitesOptions {
margin-bottom: var(--spacing-1);
}

.banDomainOption {
margin: var(--spacing-1) 0;
}

.customizeMessage {
align-self: flex-start;
}
10 changes: 5 additions & 5 deletions src/core/client/admin/components/BanModal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ it("creates domain ban for unmoderated domain while updating user ban status", a
const modal = getBanModal(container, user);

const banDomainButton = within(modal).getByLabelText(
`Ban all new accounts on test.com`
`Ban all new commenter accounts from test.com`
);
userEvent.click(banDomainButton);
screen.debug(banDomainButton);
Expand Down Expand Up @@ -173,7 +173,7 @@ test.each(gteOrgMods)(
const modal = getBanModal(container, commenterUser);

const banDomainButton = within(modal).getByLabelText(
`Ban all new accounts on test.com`
`Ban all new commenter accounts from test.com`
);

expect(banDomainButton).toBeInTheDocument();
Expand All @@ -199,7 +199,7 @@ test.each(siteMods)(
const modal = getBanModal(container, commenterUser);

const banDomainButton = within(modal).queryByText(
`Ban all new accounts on test.com`
`Ban all new commenter accounts from test.com`
);

expect(banDomainButton).toBeNull();
Expand Down Expand Up @@ -234,7 +234,7 @@ it("does not display ban domain option for moderated domain", async () => {
const modal = getBanModal(container, user);

const banDomainButton = within(modal).queryByText(
`Ban all new accounts on test.com`
`Ban all new commenter accounts from test.com`
);

expect(banDomainButton).not.toBeInTheDocument();
Expand Down Expand Up @@ -280,7 +280,7 @@ test.each([...PROTECTED_EMAIL_DOMAINS.values()])(
const modal = getBanModal(container, user);

const banDomainButton = within(modal).queryByText(
`Ban all new accounts on test.com`
`Ban all new commenter accounts from test.com`
);

expect(banDomainButton).not.toBeInTheDocument();
Expand Down
Loading

0 comments on commit 5568504

Please sign in to comment.