diff --git a/.github/file-filters.yml b/.github/file-filters.yml new file mode 100644 index 000000000..d7f9cb6c0 --- /dev/null +++ b/.github/file-filters.yml @@ -0,0 +1,9 @@ +backend: &backend + - 'backend/**/*' + - 'neo4j/**/*' + +docker: &docker + - 'docker-compose.*' + +webapp: &webapp + - 'webapp/**/*' diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml new file mode 100644 index 000000000..84d87c770 --- /dev/null +++ b/.github/workflows/test-backend.yml @@ -0,0 +1,120 @@ +name: ocelot.social backend test CI + + +on: [push] + +jobs: + files-changed: + name: Detect File Changes - Backend + runs-on: ubuntu-latest + outputs: + backend: ${{ steps.changes.outputs.backend }} + docker: ${{ steps.changes.outputs.docker }} + steps: + - uses: actions/checkout@v3.3.0 + + - name: Check for frontend file changes + uses: dorny/paths-filter@v2.11.1 + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + list-files: shell + + build_test_neo4j: + name: Docker Build Test - Neo4J + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.docker == 'true' + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Neo4J | Build 'community' image + run: | + docker build --target community -t "ocelotsocialnetwork/neo4j-community:test" neo4j/ + docker save "ocelotsocialnetwork/neo4j-community:test" > /tmp/neo4j.tar + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: docker-neo4j-image + path: /tmp/neo4j.tar + + build_test_backend: + name: Docker Build Test - Backend + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.docker == 'true' + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: backend | Build 'test' image + run: | + docker build --target test -t "ocelotsocialnetwork/backend:test" backend/ + docker save "ocelotsocialnetwork/backend:test" > /tmp/backend.tar + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: docker-backend-test + path: /tmp/backend.tar + + lint_backend: + name: Lint Backend + if: needs.files-changed.outputs.backend == 'true' + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: backend | Lint + run: cd backend && yarn && yarn run lint + + unit_test_backend: + name: Unit tests - Backend + if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.docker == 'true' + needs: [files-changed, build_test_neo4j, build_test_backend] + runs-on: ubuntu-latest + permissions: + checks: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download Docker Image (Neo4J) + uses: actions/download-artifact@v3 + with: + name: docker-neo4j-image + path: /tmp + + - name: Load Docker Image + run: docker load < /tmp/neo4j.tar + + - name: Download Docker Image (Backend) + uses: actions/download-artifact@v3 + with: + name: docker-backend-test + path: /tmp + + - name: Load Docker Image + run: docker load < /tmp/backend.tar + + - name: backend | copy env files webapp + run: cp webapp/.env.template webapp/.env + - name: backend | copy env files backend + run: cp backend/.env.template backend/.env + + - name: backend | docker-compose + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps neo4j backend + + - name: backend | Initialize Database + run: docker-compose exec -T backend yarn db:migrate init + + - name: backend | Migrate Database Up + run: docker-compose exec -T backend yarn db:migrate up + + - name: backend | Unit test incl. coverage check + run: docker-compose exec -T backend yarn test diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml new file mode 100644 index 000000000..d76ab129f --- /dev/null +++ b/.github/workflows/test-e2e.yml @@ -0,0 +1,41 @@ +name: ocelot.social end-to-end test CI +on: push + +jobs: + fullstack_tests: + name: Fullstack tests + runs-on: ubuntu-latest + env: + jobs: 8 + strategy: + matrix: + # run copies of the current job in parallel + job: [1, 2, 3, 4, 5, 6, 7, 8] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: webapp | copy env file + run: cp webapp/.env.template webapp/.env + + - name: backend | copy env file + run: cp backend/.env.template backend/.env + + - name: boot up test system | docker-compose + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp neo4j backend + + - name: cypress | Fullstack tests + id: e2e-tests + run: | + yarn install + yarn run cypress:run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }} ) + + ########################################################################## + # UPLOAD SCREENSHOTS - IF TESTS FAIL ##################################### + ########################################################################## + - name: Full stack tests | if any test failed, upload screenshots + if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} + uses: actions/upload-artifact@v3 + with: + name: cypress-screenshots + path: cypress/screenshots/ diff --git a/.github/workflows/test-webapp.yml b/.github/workflows/test-webapp.yml new file mode 100644 index 000000000..9ca3023cc --- /dev/null +++ b/.github/workflows/test-webapp.yml @@ -0,0 +1,101 @@ +name: ocelot.social webapp test CI + + +on: [push] + +jobs: + files-changed: + name: Detect File Changes - Webapp + runs-on: ubuntu-latest + outputs: + docker: ${{ steps.changes.outputs.docker }} + webapp: ${{ steps.changes.outputs.webapp }} + steps: + - uses: actions/checkout@v3.3.0 + + - name: Check for frontend file changes + uses: dorny/paths-filter@v2.11.1 + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + list-files: shell + + prepare: + name: Prepare + if: needs.files-changed.outputs.webapp + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Check translation files + run: | + scripts/translations/sort.sh + scripts/translations/missing-keys.sh + + build_test_webapp: + name: Docker Build Test - Webapp + if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp + needs: [files-changed, prepare] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: webapp | Build 'test' image + run: | + docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/ + docker save "ocelotsocialnetwork/webapp:test" > /tmp/webapp.tar + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: docker-webapp-test + path: /tmp/webapp.tar + + lint_webapp: + name: Lint Webapp + if: needs.files-changed.outputs.webapp + needs: files-changed + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: webapp | Lint + run: cd webapp && yarn && yarn run lint + + unit_test_webapp: + name: Unit Tests - Webapp + if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp + needs: [files-changed, build_test_webapp] + runs-on: ubuntu-latest + permissions: + checks: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download Docker Image (Webapp) + uses: actions/download-artifact@v3 + with: + name: docker-webapp-test + path: /tmp + + - name: Load Docker Image + run: docker load < /tmp/webapp.tar + + - name: backend | copy env files webapp + run: cp webapp/.env.template webapp/.env + + - name: backend | copy env files backend + run: cp backend/.env.template backend/.env + + - name: backend | docker-compose + run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp + + - name: webapp | Unit tests incl. coverage check + run: docker-compose exec -T webapp yarn test + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1740c09fe..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,344 +0,0 @@ -name: ocelot.social test CI - - -on: [push] - -jobs: - ############################################################################## - # JOB: PREPARE ##################################################### - ############################################################################## - prepare: - name: Prepare - runs-on: ubuntu-latest - # needs: [nothing] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # TODO: DO STUFF ??? ##################################################### - ########################################################################## - - name: Check translation files - run: | - scripts/translations/sort.sh - scripts/translations/missing-keys.sh - - ############################################################################## - # JOB: DOCKER BUILD TEST NEO4J ############################################### - ############################################################################## - build_test_neo4j: - name: Docker Build Test - Neo4J - runs-on: ubuntu-latest - needs: [prepare] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # NEO4J ################################################################## - ########################################################################## - - name: Neo4J | Build `community` image - run: | - docker build --target community -t "ocelotsocialnetwork/neo4j-community:test" neo4j/ - docker save "ocelotsocialnetwork/neo4j-community:test" > /tmp/neo4j.tar - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: docker-neo4j-image - path: /tmp/neo4j.tar - - ############################################################################## - # JOB: DOCKER BUILD TEST BACKEND ############################################# - ############################################################################## - build_test_backend: - name: Docker Build Test - Backend - runs-on: ubuntu-latest - needs: [prepare] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # BUILD BACKEND DOCKER IMAGE (build) ##################################### - ########################################################################## - - name: backend | Build `test` image - run: | - docker build --target test -t "ocelotsocialnetwork/backend:test" backend/ - docker save "ocelotsocialnetwork/backend:test" > /tmp/backend.tar - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: docker-backend-test - path: /tmp/backend.tar - - ############################################################################## - # JOB: DOCKER BUILD TEST WEBAPP ############################################## - ############################################################################## - build_test_webapp: - name: Docker Build Test - WebApp - runs-on: ubuntu-latest - needs: [prepare] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # BUILD WEBAPP DOCKER IMAGE (build) ###################################### - ########################################################################## - - name: webapp | Build `test` image - run: | - docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/ - docker save "ocelotsocialnetwork/webapp:test" > /tmp/webapp.tar - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: docker-webapp-test - path: /tmp/webapp.tar - - ############################################################################## - # JOB: LINT BACKEND ########################################################## - ############################################################################## - lint_backend: - name: Lint backend - runs-on: ubuntu-latest - needs: [build_test_backend] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-backend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/backend.tar - ########################################################################## - # LINT BACKEND ########################################################### - ########################################################################## - - name: backend | Lint - run: docker run --rm ocelotsocialnetwork/backend:test yarn run lint - - ############################################################################## - # JOB: LINT WEBAPP ########################################################### - ############################################################################## - lint_webapp: - name: Lint webapp - runs-on: ubuntu-latest - needs: [build_test_webapp] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGE ################################################## - ########################################################################## - - name: Download Docker Image (Webapp) - uses: actions/download-artifact@v3 - with: - name: docker-webapp-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/webapp.tar - ########################################################################## - # LINT WEBAPP ############################################################ - ########################################################################## - - name: webapp | Lint - run: docker run --rm ocelotsocialnetwork/webapp:test yarn run lint - - ############################################################################## - # JOB: UNIT TEST BACKEND ##################################################### - ############################################################################## - unit_test_backend: - name: Unit tests - backend - runs-on: ubuntu-latest - needs: [build_test_neo4j,build_test_backend] - permissions: - checks: write - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Neo4J) - uses: actions/download-artifact@v3 - with: - name: docker-neo4j-image - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/neo4j.tar - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-backend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/backend.tar - ########################################################################## - # UNIT TESTS BACKEND ##################################################### - ########################################################################## - - name: backend | copy env files webapp - run: cp webapp/.env.template webapp/.env - - name: backend | copy env files backend - run: cp backend/.env.template backend/.env - - name: backend | docker-compose - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps neo4j backend - - name: backend | Initialize Database - run: docker-compose exec -T backend yarn db:migrate init - - name: backend | Migrate Database Up - run: docker-compose exec -T backend yarn db:migrate up - - name: backend | Unit test - run: docker-compose exec -T backend yarn test - ########################################################################## - # COVERAGE CHECK BACKEND ################################################# - ########################################################################## - - name: backend | Coverage check - uses: webcraftmedia/coverage-check-action@master - with: - report_name: Coverage Backend - type: lcov - result_path: ./coverage/lcov.info - min_coverage: 57 - token: ${{ github.token }} - - ############################################################################## - # JOB: UNIT TEST WEBAPP ###################################################### - ############################################################################## - unit_test_webapp: - name: Unit tests - webapp - runs-on: ubuntu-latest - needs: [build_test_webapp] - permissions: - checks: write - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Webapp) - uses: actions/download-artifact@v3 - with: - name: docker-webapp-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/webapp.tar - ########################################################################## - # UNIT TESTS WEBAPP ###################################################### - ########################################################################## - - name: backend | copy env files webapp - run: cp webapp/.env.template webapp/.env - - name: backend | copy env files backend - run: cp backend/.env.template backend/.env - - name: backend | docker-compose - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp - - name: webapp | Unit tests - run: docker-compose exec -T webapp yarn test - ########################################################################## - # COVERAGE REPORT FRONTEND ################################################ - ########################################################################## - #- name: frontend | Coverage report - # uses: romeovs/lcov-reporter-action@v0.2.21 - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # lcov-file: ./coverage/lcov.info - ########################################################################## - # COVERAGE CHECK WEBAPP ################################################## - ########################################################################## - - name: webapp | Coverage check - uses: webcraftmedia/coverage-check-action@master - with: - report_name: Coverage Webapp - type: lcov - result_path: ./coverage/lcov.info - min_coverage: 83 - token: ${{ github.token }} - - ############################################################################## - # JOB: FULLSTACK TESTS ####################################################### - ############################################################################## - fullstack_tests: - name: Fullstack tests - runs-on: ubuntu-latest - needs: [build_test_webapp, build_test_backend, build_test_neo4j] - env: - jobs: 8 - strategy: - matrix: - # run copies of the current job in parallel - job: [1, 2, 3, 4, 5, 6, 7, 8] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Neo4J) - uses: actions/download-artifact@v3 - with: - name: docker-neo4j-image - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/neo4j.tar - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v3 - with: - name: docker-backend-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/backend.tar - - name: Download Docker Image (Webapp) - uses: actions/download-artifact@v3 - with: - name: docker-webapp-test - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/webapp.tar - ########################################################################## - # FULLSTACK TESTS CYPRESS ################################################ - ########################################################################## - - name: webapp | copy env files webapp - run: cp webapp/.env.template webapp/.env - - name: backend | copy env files backend - run: cp backend/.env.template backend/.env - - name: backend | docker-compose - run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp neo4j backend - - name: cypress | Fullstack tests - id: e2e-tests - run: | - yarn install - yarn run cypress:run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }} ) - ########################################################################## - # UPLOAD SCREENSHOTS - IF TESTS FAIL ##################################### - ########################################################################## - - name: Full stack tests | if any test failed, upload screenshots - if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} - uses: actions/upload-artifact@v3 - with: - name: cypress-screenshots - path: cypress/screenshots/ diff --git a/backend/jest.config.js b/backend/jest.config.js index aabb59083..0f8017fb1 100644 --- a/backend/jest.config.js +++ b/backend/jest.config.js @@ -8,7 +8,11 @@ module.exports = { '!**/dist/**', '!**/src/**/?(*.)+(spec|test).js?(x)' ], - coverageReporters: ['lcov', 'text'], + coverageThreshold: { + global: { + lines: 57, + }, + }, testMatch: ['**/src/**/?(*.)+(spec|test).js?(x)'], setupFilesAfterEnv: ['/test/setup.js'] } diff --git a/backend/package.json b/backend/package.json index 13681df2b..f32881357 100644 --- a/backend/package.json +++ b/backend/package.json @@ -76,7 +76,7 @@ "metascraper-lang-detector": "^4.10.2", "metascraper-logo": "^5.33.5", "metascraper-publisher": "^5.33.5", - "metascraper-soundcloud": "^5.33.5", + "metascraper-soundcloud": "^5.34.2", "metascraper-title": "^5.33.5", "metascraper-url": "^5.34.2", "metascraper-video": "^5.33.5", diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index 42a755e8f..b6f3457ae 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -334,6 +334,7 @@ export default { ` MATCH (user:User {id: $userId}) WHERE user.role = 'admin' MATCH (post:Post {id: $params.id}) + WHERE NOT((post)-[:IN]->(:Group)) MERGE (user)-[pinned:PINNED {createdAt: toString(datetime())}]->(post) SET post.pinned = true RETURN post, pinned.createdAt as pinnedAt @@ -346,10 +347,12 @@ export default { })) }) const [transactionResult] = await writeTxResultPromise - const { pinnedPost, pinnedAt } = transactionResult - pinnedPostWithNestedAttributes = { - ...pinnedPost, - pinnedAt, + if (transactionResult) { + const { pinnedPost, pinnedAt } = transactionResult + pinnedPostWithNestedAttributes = { + ...pinnedPost, + pinnedAt, + } } } finally { session.close() diff --git a/backend/src/schema/resolvers/searches.js b/backend/src/schema/resolvers/searches.js index 3fdf22da3..a67abe90d 100644 --- a/backend/src/schema/resolvers/searches.js +++ b/backend/src/schema/resolvers/searches.js @@ -223,8 +223,7 @@ export default { }, searchResults: async (_parent, args, context, _resolveInfo) => { const { query, limit } = args - let userId = null - if (context.user) userId = context.user.id + const userId = context.user?.id || null const searchType = query.replace(/^([!@#&]?).*$/, '$1') const searchString = query.replace(/^([!@#&])/, '') diff --git a/backend/src/schema/resolvers/searches/queryString.js b/backend/src/schema/resolvers/searches/queryString.js index 5ef84cdce..8f415c5e6 100644 --- a/backend/src/schema/resolvers/searches/queryString.js +++ b/backend/src/schema/resolvers/searches/queryString.js @@ -33,7 +33,7 @@ const matchSomeWordsExactly = (str, boost = 2) => { const matchBeginningOfWords = (str) => { return str .split(' ') - .filter((s) => s.length > 3) + .filter((s) => s.length >= 2) .map((s) => s + '*') .join(' ') } diff --git a/backend/src/schema/resolvers/searches/queryString.spec.js b/backend/src/schema/resolvers/searches/queryString.spec.js index 23a746be1..fe3c91d3c 100644 --- a/backend/src/schema/resolvers/searches/queryString.spec.js +++ b/backend/src/schema/resolvers/searches/queryString.spec.js @@ -37,7 +37,7 @@ describe('queryString', () => { describe('globbing for longer words', () => { it('globs words with more than three characters', () => { - expect(queryString('a couple of words')).toContain('couple* words*') + expect(queryString('a couple of words')).toContain('couple* of* words*') }) }) }) diff --git a/backend/yarn.lock b/backend/yarn.lock index 461682a29..293e189dc 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -7614,12 +7614,12 @@ metascraper-publisher@^5.33.5: dependencies: "@metascraper/helpers" "^5.33.5" -metascraper-soundcloud@^5.33.5: - version "5.33.5" - resolved "https://registry.yarnpkg.com/metascraper-soundcloud/-/metascraper-soundcloud-5.33.5.tgz#9cd39e7ff432e715f8ecdca5256e7ea67f485557" - integrity sha512-hkDhRfTKEUugIN9Gxh/l9HuWlkNAOKEBXov/9fYKbIMgaj7e2UU7bkNYjaDOXzMikCRWEIrrGP3UzwwIcs6Gjg== +metascraper-soundcloud@^5.34.2: + version "5.34.2" + resolved "https://registry.yarnpkg.com/metascraper-soundcloud/-/metascraper-soundcloud-5.34.2.tgz#ee1077b4836321ccfb22bcab4bfae7360dd571a3" + integrity sha512-1VafeFnlzJaYUlq8XbppQauz0i9xM8QycJU8k4ONftZwRtikQBIjRe5BMXr/s5n32831vBooRz8ksz0CXkjVlQ== dependencies: - "@metascraper/helpers" "^5.33.5" + "@metascraper/helpers" "^5.34.2" metascraper-title@^5.33.5: version "5.33.5" diff --git a/deployment/scripts/branded-images.build.sh b/deployment/scripts/branded-images.build.sh index e33c9a546..fa9da67d1 100755 --- a/deployment/scripts/branded-images.build.sh +++ b/deployment/scripts/branded-images.build.sh @@ -25,7 +25,6 @@ echo "Using DOCKERHUB_BRAND_VARRIANT=${DOCKERHUB_BRAND_VARRIANT}" # configuration DOCKERHUB_ORGANISATION=${DOCKERHUB_ORGANISATION:-"ocelotsocialnetwork"} -=${DOCKERHUB_BRAND_VARRIANT:-"stage-ocelot-social"} OCELOT_VERSION=${OCELOT_VERSION:-$(node -p -e "require('${SCRIPT_DIR}/../../package.json').version")} OCELOT_GITHUB_RUN_NUMBER=${OCELOT_GITHUB_RUN_NUMBER:-master} OCELOT_VERSION_BUILD=${OCELOT_VERSION_BUILD:-${OCELOT_VERSION}-${OCELOT_GITHUB_RUN_NUMBER}} diff --git a/webapp/components/ContentMenu/ContentMenu.vue b/webapp/components/ContentMenu/ContentMenu.vue index 60bcccf43..d723a9667 100644 --- a/webapp/components/ContentMenu/ContentMenu.vue +++ b/webapp/components/ContentMenu/ContentMenu.vue @@ -80,7 +80,7 @@ export default { }) } - if (this.isAdmin) { + if (this.isAdmin && !this.resource.group) { if (!this.resource.pinnedBy) { routes.push({ label: this.$t(`post.menu.pin`), diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js index cda9150b8..223ee6186 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js +++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js @@ -63,13 +63,6 @@ describe('SearchableInput.vue', () => { expect(select.element.value).toBe('abcd') }) - it('calls onDelete when the delete key is pressed', () => { - const spy = jest.spyOn(wrapper.vm, 'onDelete') - select.trigger('input') - select.trigger('keyup.delete') - expect(spy).toHaveBeenCalledTimes(1) - }) - describe('navigating to resource', () => { beforeEach(() => { propsData = { options: searchResults } diff --git a/webapp/components/generic/SearchableInput/SearchableInput.vue b/webapp/components/generic/SearchableInput/SearchableInput.vue index 2149732c5..b0e813b45 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.vue +++ b/webapp/components/generic/SearchableInput/SearchableInput.vue @@ -1,9 +1,10 @@