-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' into REseo-kulla-2024-06-16-14-17
- Loading branch information
Showing
178 changed files
with
1,219 additions
and
1,295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Push DB migration image | ||
on: | ||
# not a problem if we do it at every push because it will check if the image already exists | ||
push: | ||
|
||
jobs: | ||
docker-image: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: serlo/configure-repositories/actions/setup-node@main | ||
- uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: '${{ secrets.GCP_KEY_CONTAINER_REGISTRY }}' | ||
- run: gcloud auth configure-docker | ||
- uses: google-github-actions/setup-gcloud@v2 | ||
- run: yarn migrate:push-image |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+25.4 KB
...cript-npm-4.0.7-ae4a7db3ec-d6717755d6.zip → ...cript-npm-4.0.9-2d615e0202-843081bc48.zip
Binary file not shown.
Binary file added
BIN
+143 KB
.yarn/cache/@graphql-codegen-visitor-plugin-common-npm-5.3.1-5a769a1d60-273f99a912.zip
Binary file not shown.
Binary file added
BIN
+2.73 KB
.yarn/cache/@isaacs-string-locale-compare-npm-1.1.0-3911094464-7287da5d11.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+5.41 KB
.yarn/cache/@msgpackr-extract-msgpackr-extract-darwin-arm64-npm-3.0.3-23b9647943-8.zip
Binary file not shown.
Binary file added
BIN
+11.2 KB
.yarn/cache/@msgpackr-extract-msgpackr-extract-linux-arm64-npm-3.0.3-9da3d01c14-8.zip
Binary file not shown.
Binary file renamed
BIN
+239 KB
...r-sdk-npm-4.4.0-4d251260ad-fa86f3e1a2.zip → ...r-sdk-npm-4.5.0-0df7aff729-b83efd4a83.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+5.35 KB
.yarn/cache/@npmcli-map-workspaces-npm-3.0.6-dcaa328de8-bdb09ee1d0.zip
Binary file not shown.
Binary file added
BIN
+11.8 KB
.yarn/cache/@npmcli-metavuln-calculator-npm-7.1.1-392e62877e-c6297e40f9.zip
Binary file not shown.
Binary file added
BIN
+2.51 KB
.yarn/cache/@npmcli-name-from-folder-npm-2.0.0-18e2dba870-fb3ef891aa.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+113 KB
...logs-npm-0.51.1-8cf4a62f4d-b1c99f544b.zip → ...logs-npm-0.52.1-2fac882800-500cd35527.zip
Binary file not shown.
Binary file renamed
BIN
+26 KB
...ooks-npm-1.25.0-40d687df05-f50f6ef621.zip → ...ooks-npm-1.25.1-494f38401f-fb2ac7381e.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+49.3 KB
...http-npm-0.52.0-0989457f87-492ed0a725.zip → ...http-npm-0.52.1-b41aa393e8-67a31e14d9.zip
Binary file not shown.
Binary file removed
BIN
-190 KB
.yarn/cache/@opentelemetry-instrumentation-npm-0.51.1-648402f009-b9d097b801.zip
Binary file not shown.
Binary file added
BIN
+196 KB
.yarn/cache/@opentelemetry-instrumentation-npm-0.52.1-8477b6362c-e8b4f202dc.zip
Binary file not shown.
Binary file added
BIN
+350 KB
.yarn/cache/@opentelemetry-resources-npm-1.25.1-d294145a2e-806e5aabbc.zip
Binary file not shown.
Binary file added
BIN
+350 KB
.yarn/cache/@opentelemetry-sdk-trace-base-npm-1.25.1-66f626c1e5-8ac97f7d8d.zip
Binary file not shown.
Binary file added
BIN
+290 KB
.yarn/cache/@opentelemetry-semantic-conventions-npm-1.25.1-e2e79093b3-fea418a4b0.zip
Binary file not shown.
Binary file removed
BIN
-17.1 KB
.yarn/cache/@prisma-instrumentation-npm-5.15.0-d26031e0c1-310690dcae.zip
Binary file not shown.
Binary file added
BIN
+17.1 KB
.yarn/cache/@prisma-instrumentation-npm-5.16.1-a17d037152-b1e03dbf1f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+158 KB
.yarn/cache/@sentry-opentelemetry-npm-8.15.0-0c124e7b6f-b836b10dcc.zip
Binary file not shown.
Binary file removed
BIN
-155 KB
.yarn/cache/@sentry-opentelemetry-npm-8.9.2-ecdec3fb99-5e2960aae2.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-57 KB
.yarn/cache/@sigstore-protobuf-specs-npm-0.2.1-feecdcc08c-ddb7c829c7.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-3.98 KB
.yarn/cache/@tufjs-canonical-json-npm-1.0.0-66d27d850f-9ff3bcd129.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+111 KB
...amda-npm-0.30.0-b38ed8b5be-abe9d9c872.zip → ...amda-npm-0.30.1-a483203d7c-3975599065.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-8.97 KB
.yarn/cache/@typescript-eslint-parser-npm-7.13.0-bd1fb22096-dd7ef8380d.zip
Binary file not shown.
Binary file added
BIN
+8.96 KB
.yarn/cache/@typescript-eslint-parser-npm-7.14.1-e4f1731991-e98ee179e3.zip
Binary file not shown.
Binary file added
BIN
+337 KB
.yarn/cache/@typescript-eslint-scope-manager-npm-7.14.1-bb18a74a6c-b9351e4887.zip
Binary file not shown.
Binary file added
BIN
+31.4 KB
.yarn/cache/@typescript-eslint-types-npm-7.14.1-832bf03dbe-20136fc676.zip
Binary file not shown.
Binary file added
BIN
+180 KB
.yarn/cache/@typescript-eslint-typescript-estree-npm-7.14.1-609318c827-4ee6c1c629.zip
Binary file not shown.
Binary file added
BIN
+9.81 KB
.yarn/cache/@typescript-eslint-visitor-keys-npm-7.14.1-0d9c554edb-6f091423d4.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+11.5 KB
...mysql-npm-2.3.2-ebbe30d2e6-84ce106c90.zip → ...mysql-npm-3.0.0-7ba118ae21-f69a45985f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+238 KB
...eact-npm-7.34.2-51c08a36f1-aed331239f.zip → ...eact-npm-7.34.3-211c30e474-1a519b9792.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+417 KB
...phql-npm-16.8.2-d0a0630c7d-1a5ba8087b.zip → ...phql-npm-16.9.0-a36f71845f-8cb3d54100.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+6.58 KB
...-json-npm-5.0.0-0656c8f580-ad601c717d.zip → ...-json-npm-6.0.3-2a9f8f943e-332de50c74.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+3.96 KB
...ccess-npm-7.0.2-57b91bfda5-73d49f3939.zip → ...ccess-npm-8.0.6-614305a214-62fa6a4763.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-5.72 KB
.yarn/cache/minipass-json-stream-npm-1.0.1-96490706d6-791b696a27.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-11.4 KB
.yarn/cache/normalize-package-data-npm-5.0.0-6327e2af68-a459f05eaf.zip
Binary file not shown.
Binary file added
BIN
+11.4 KB
.yarn/cache/normalize-package-data-npm-6.0.2-dc1f732439-ea35f8de68.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-32.5 KB
.yarn/cache/npm-normalize-package-bin-npm-1.0.1-2cf38a5d95-ae7f15155a.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-15.1 KB
.yarn/cache/npm-registry-fetch-npm-14.0.5-6b3e6c0dd0-c636496429.zip
Binary file not shown.
Binary file renamed
BIN
+15.1 KB
...etch-npm-16.2.1-f5790ad261-0c606dffcd.zip → ...etch-npm-17.1.0-8eabd327ea-12452e690a.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+605 KB
...enai-npm-4.51.0-6b8c06a084-7a8dd36e2c.zip → ...enai-npm-4.52.2-2dd30c51e1-5e43ed945a.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+59 KB
.yarn/cache/postcss-selector-parser-npm-6.1.0-f392fdf6ae-449f614e67.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+31.3 KB
.yarn/cache/promise-all-reject-late-npm-1.0.1-19ba0dce9c-d7d61ac412.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+102 KB
...jest-npm-29.1.4-b7c081a1e2-e36cba389a.zip → ...jest-npm-29.1.5-70c1a31df0-96bfdea46d.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-7.56 KB
.yarn/cache/validate-npm-package-name-npm-3.0.0-e44c263962-ce4c68207a.zip
Binary file not shown.
Binary file removed
BIN
-4.26 KB
.yarn/cache/validate-npm-package-name-npm-5.0.0-fc061c1b84-5342a99498.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+35 KB
...he/ws-npm-7.5.9-26f12a5ed6-c3c100a181.zip → ...e/ws-npm-7.5.10-878ccb886b-f9bb062abf.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,114 @@ | ||
import gql from 'graphql-tag' | ||
|
||
import { Client, entityQuery } from '../../__utils__' | ||
import { user } from '../../../__fixtures__' | ||
import { Client } from '../../__utils__' | ||
import { encodeThreadId } from '~/schema/thread/utils' | ||
|
||
const input = { id: encodeThreadId(34161), status: 'done' } | ||
const mutation = new Client({ userId: 1 }).prepareQuery({ | ||
query: gql` | ||
mutation setThreadStatus($input: ThreadSetThreadStatusInput!) { | ||
thread { | ||
setThreadStatus(input: $input) { | ||
success | ||
const moderator = { ...user, id: 10, roles: ['de_moderator'] } | ||
const threadInitiator = { ...user, id: 1194, roles: ['login'] } | ||
|
||
const mutation = new Client({ userId: threadInitiator.id }) | ||
.prepareQuery({ | ||
query: gql` | ||
mutation setThreadStatus($input: ThreadSetThreadStatusInput!) { | ||
thread { | ||
setThreadStatus(input: $input) { | ||
success | ||
} | ||
} | ||
} | ||
`, | ||
}) | ||
.withInput({ id: encodeThreadId(35163), status: 'open' }) | ||
|
||
test('status is actually changed', async function () { | ||
const threadQuery = new Client({ userId: user.id }) | ||
.prepareQuery({ | ||
query: gql` | ||
query ( | ||
$first: Int | ||
$after: String | ||
$instance: Instance | ||
$subjectId: String | ||
$status: CommentStatus | ||
) { | ||
thread { | ||
allThreads( | ||
first: $first | ||
after: $after | ||
instance: $instance | ||
subjectId: $subjectId | ||
status: $status | ||
) { | ||
nodes { | ||
id | ||
status | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
}) | ||
.withVariables({ first: 3 }) | ||
|
||
const queryResult = await threadQuery.getData() | ||
const data = queryResult as { | ||
thread: { | ||
allThreads: { | ||
nodes: Array<{ id: string; status: string }> | ||
} | ||
} | ||
`, | ||
variables: { input }, | ||
}) | ||
} | ||
|
||
test('changes status of thread', async function () { | ||
await entityQuery.withVariables({ id: 34159 }).shouldReturnData({ | ||
uuid: { threads: { nodes: [{ status: 'noStatus' }] } }, | ||
const threadIDs = data.thread.allThreads.nodes.map((node) => { | ||
expect(node.status).toBe('noStatus') | ||
return node.id | ||
}) | ||
|
||
await mutation.shouldReturnData({ | ||
thread: { setThreadStatus: { success: true } }, | ||
}) | ||
await mutation | ||
.withContext({ userId: moderator.id }) | ||
.withInput({ id: threadIDs, status: 'done' }) | ||
.shouldReturnData({ | ||
thread: { setThreadStatus: { success: true } }, | ||
}) | ||
|
||
await entityQuery.withVariables({ id: 34159 }).shouldReturnData({ | ||
uuid: { threads: { nodes: [{ status: 'done' }] } }, | ||
await threadQuery.shouldReturnData({ | ||
thread: { | ||
allThreads: { | ||
nodes: threadIDs.map((id) => ({ id, status: 'done' })), | ||
}, | ||
}, | ||
}) | ||
}) | ||
|
||
test('unauthenticated user gets error', async () => { | ||
await mutation.forUnauthenticatedUser().shouldFailWithError('UNAUTHENTICATED') | ||
}) | ||
|
||
test('thread initiators are allowed to change thread status', async () => { | ||
await mutation.shouldReturnData({ | ||
thread: { setThreadStatus: { success: true } }, | ||
}) | ||
}) | ||
|
||
test('commentators are allowed to change thread status', async () => { | ||
await mutation.withContext({ userId: 32543 }).shouldReturnData({ | ||
const commentatorId = 266 | ||
// Let's remove all other roles of this user to be sure that they will change status although they are just login user | ||
await global.databaseForTests.mutate( | ||
'DELETE FROM role_user WHERE user_id = ? AND role_id > 2', | ||
[commentatorId], | ||
) | ||
await mutation.withContext({ userId: commentatorId }).shouldReturnData({ | ||
thread: { setThreadStatus: { success: true } }, | ||
}) | ||
}) | ||
|
||
test('moderators are allowed to change thread status', async () => { | ||
const newMutation = await mutation.forUser('de_moderator') | ||
await newMutation.shouldReturnData({ | ||
await mutation.withContext({ userId: moderator.id }).shouldReturnData({ | ||
thread: { setThreadStatus: { success: true } }, | ||
}) | ||
}) | ||
|
||
test('unauthorized users get error', async () => { | ||
await mutation.forLoginUser().shouldFailWithError('FORBIDDEN') | ||
}) | ||
|
||
test('unauthenticated user gets error', async () => { | ||
await mutation.forUnauthenticatedUser().shouldFailWithError('UNAUTHENTICATED') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM node:20-alpine AS base_image | ||
WORKDIR /app | ||
COPY package.json . | ||
RUN corepack enable | ||
RUN yarn set version 3.x | ||
|
||
FROM base_image AS build_migrations | ||
COPY scripts scripts | ||
COPY src src | ||
RUN yarn | ||
RUN yarn build:all | ||
|
||
FROM base_image AS runner | ||
RUN yarn plugin import workspace-tools | ||
RUN yarn workspaces focus --production | ||
COPY --from=build_migrations /app/migrations migrations | ||
COPY migrations/package.json migrations/package.json | ||
COPY database.json . | ||
|
||
ENTRYPOINT ["yarn", "db-migrate"] | ||
CMD ["up"] |
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.