diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index fbf7173fc..1d2aef77e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,7 +8,6 @@ title: 🐛 [Bug] ## :bug: Bugreport - ### Steps to reproduce the behavior 1. 2. @@ -16,17 +15,11 @@ title: 🐛 [Bug] 4. ... 5. Profit - ### Expected behavior - ### Version & Environment - Type: [] - - OS: [] - - Browser: [] - - Version [] - - Device: [] + ### Additional context diff --git a/.github/ISSUE_TEMPLATE/devops_ticket.md b/.github/ISSUE_TEMPLATE/devops_ticket.md index 6f8ea55cb..77355d1cf 100644 --- a/.github/ISSUE_TEMPLATE/devops_ticket.md +++ b/.github/ISSUE_TEMPLATE/devops_ticket.md @@ -5,7 +5,7 @@ labels: devops title: 💥 [DevOps] --- -## :fire: DevOps ticket +## 💥 DevOps ticket ### Motive diff --git a/.github/ISSUE_TEMPLATE/refactor_tickets.md b/.github/ISSUE_TEMPLATE/refactor_tickets.md index b6c799f67..b595abd5d 100644 --- a/.github/ISSUE_TEMPLATE/refactor_tickets.md +++ b/.github/ISSUE_TEMPLATE/refactor_tickets.md @@ -10,6 +10,7 @@ title: 🔧 [Refactor] ### Motive + ### Related issues diff --git a/.github/semantic.yml b/.github/semantic.yml deleted file mode 100644 index 3b523527b..000000000 --- a/.github/semantic.yml +++ /dev/null @@ -1,2 +0,0 @@ -# Always validate the PR title, and ignore the commits -titleOnly: true \ No newline at end of file diff --git a/.github/stale-disabled.yml b/.github/stale-disabled.yml deleted file mode 100644 index 0458d1a5a..000000000 --- a/.github/stale-disabled.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 30 -# Issues with these labels will never be considered stale -exemptLabels: - - pinned - - security - - bounty -# Label to use when marking an issue as stale -staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 551f91c43..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: CI - -on: [push] - -jobs: - build: - name: Continuous Integration - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Check translation files - run: | - scripts/translations/sort.sh - scripts/translations/missing-keys.sh - - ########################################################################## - # NEO4J ################################################################## - ########################################################################## - - name: Neo4J | Build `community` image - uses: docker/build-push-action@v1.1.0 - with: - repository: ocelotsocialnetwork/neo4j - tags: latest - path: neo4j/ - push: false - - ########################################################################## - # BACKEND ################################################################ - ########################################################################## - # TODO: We want to push this to dockerhub - #- name: Build backend production image - # uses: docker/build-push-action@v1.1.0 - # with: - # repository: ocelotsocialnetwork/backend - # tags: production - # target: production - # path: backend/ - # push: false - - # Build Docker Image (build) - - name: backend | Build `build` image - uses: docker/build-push-action@v1.1.0 - with: - repository: ocelotsocialnetwork/backend - tags: build - target: build - path: backend/ - push: false - - # Lint - - name: backend | Lint - run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint - - # Unit Tests - #- name: backend | Unit tests - # run: | - # docker-compose up - # docker-compose exec backend yarn test - - ########################################################################## - # WEBAPP ################################################################# - ########################################################################## - # TODO: We want to push this to dockerhub - #- name: Build webapp production image - # uses: docker/build-push-action@v1.1.0 - # with: - # repository: ocelotsocialnetwork/webapp - # tags: production - # target: production - # path: webapp/ - # push: false - - # Build Docker Image (build) - - name: webapp | Build `build` image - uses: docker/build-push-action@v1.1.0 - with: - repository: ocelotsocialnetwork/webapp - tags: build - target: build - path: webapp/ - push: false - - # Lint - - name: webapp | Lint - run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint - - # Unit Tests - - name: webapp | Unit tests - run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..276589dc0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,244 @@ +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@v2 + ########################################################################## + # 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@v2 + ########################################################################## + # NEO4J ################################################################## + ########################################################################## + - name: Neo4J | Build `community` image + run: | + docker build --target community -t "ocelotsocialnetwork/neo4j:community" neo4j/ + docker save "ocelotsocialnetwork/neo4j:community" > /tmp/neo4j.tar + - name: Upload Artifact + uses: actions/upload-artifact@v2 + 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@v2 + ########################################################################## + # 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@v2 + 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@v2 + ########################################################################## + # 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@v2 + 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@v2 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Backend) + uses: actions/download-artifact@v2 + 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@v2 + ########################################################################## + # DOWNLOAD DOCKER IMAGE ################################################## + ########################################################################## + - name: Download Docker Image (Webapp) + uses: actions/download-artifact@v2 + 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] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # DOWNLOAD DOCKER IMAGES ################################################# + ########################################################################## + - name: Download Docker Image (Neo4J) + uses: actions/download-artifact@v2 + 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@v2 + with: + name: docker-backend-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/backend.tar + ########################################################################## + # UNIT TESTS BACKEND ##################################################### + ########################################################################## + # TODO: Why do we need those .envs? + - 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 | Unit test + run: docker-compose exec -T backend yarn test + + ############################################################################## + # JOB: UNIT TEST WEBAPP ###################################################### + ############################################################################## + unit_test_webapp: + name: Unit tests - webapp + runs-on: ubuntu-latest + needs: [build_test_webapp] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # DOWNLOAD DOCKER IMAGES ################################################# + ########################################################################## + - name: Download Docker Image (Webapp) + uses: actions/download-artifact@v2 + with: + name: docker-webapp-test + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/webapp.tar + ########################################################################## + # UNIT TESTS WEBAPP ##################################################### + ########################################################################## + # TODO: Why do we need those .envs? + - 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 run --rm ocelotsocialnetwork/webapp:build yarn run test + run: docker-compose exec -T webapp yarn test \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile index b1cd52b30..ba14e6586 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -68,6 +68,14 @@ RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build RUN yarn run build +################################################################################## +# TEST ########################################################################### +################################################################################## +FROM build as test + +# Run command +CMD /bin/sh -c "yarn run dev" + ################################################################################## # PRODUCTION (Does contain only "binary"- and static-files to reduce image size) # ################################################################################## diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js index 6fe82951e..dae6f0e48 100644 --- a/backend/src/middleware/permissionsMiddleware.js +++ b/backend/src/middleware/permissionsMiddleware.js @@ -121,6 +121,7 @@ export default shield( userData: isAuthenticated, MyInviteCodes: isAuthenticated, isValidInviteCode: allow, + queryLocations: isAuthenticated, }, Mutation: { '*': deny, diff --git a/backend/src/schema/resolvers/locations.js b/backend/src/schema/resolvers/locations.js index be72001f7..fa0feafa1 100644 --- a/backend/src/schema/resolvers/locations.js +++ b/backend/src/schema/resolvers/locations.js @@ -1,4 +1,6 @@ +import { UserInputError } from 'apollo-server' import Resolver from './helpers/Resolver' +import { queryLocations } from './users/location' export default { Location: { @@ -16,4 +18,13 @@ export default { ], }), }, + Query: { + queryLocations: async (object, args, context, resolveInfo) => { + try { + return queryLocations(args) + } catch (e) { + throw new UserInputError(e.message) + } + }, + }, } diff --git a/backend/src/schema/resolvers/users/location.js b/backend/src/schema/resolvers/users/location.js index b58d8d1aa..affd3267e 100644 --- a/backend/src/schema/resolvers/users/location.js +++ b/backend/src/schema/resolvers/users/location.js @@ -137,4 +137,15 @@ const createOrUpdateLocations = async (userId, locationName, session) => { }) } +export const queryLocations = async ({ place, lang }) => { + const res = await fetch( + `https://api.mapbox.com/geocoding/v5/mapbox.places/${place}.json?access_token=${CONFIG.MAPBOX_TOKEN}&types=region,place,country&language=${lang}`, + ) + // Return empty array if no location found or error occurred + if (!res || !res.features) { + return [] + } + return res.features +} + export default createOrUpdateLocations diff --git a/backend/src/schema/resolvers/users/location.spec.js b/backend/src/schema/resolvers/users/location.spec.js index 3044e4b6f..0c871b168 100644 --- a/backend/src/schema/resolvers/users/location.spec.js +++ b/backend/src/schema/resolvers/users/location.spec.js @@ -6,7 +6,7 @@ import createServer from '../../../server' const neode = getNeode() const driver = getDriver() -let authenticatedUser, mutate, variables +let authenticatedUser, mutate, query, variables const updateUserMutation = gql` mutation($id: ID!, $name: String!, $locationName: String) { @@ -16,6 +16,15 @@ const updateUserMutation = gql` } ` +const queryLocations = gql` + query($place: String!, $lang: String!) { + queryLocations(place: $place, lang: $lang) { + place_name + id + } + } +` + const newlyCreatedNodesWithLocales = [ { city: { @@ -76,6 +85,7 @@ beforeAll(() => { }, }) mutate = createTestClient(server).mutate + query = createTestClient(server).query }) beforeEach(() => { @@ -85,6 +95,66 @@ beforeEach(() => { afterEach(cleanDatabase) +describe('Location Service', () => { + // Authentication + // TODO: unify, externalize, simplify, wtf? + let user + beforeEach(async () => { + user = await Factory.build('user', { + id: 'location-user', + }) + authenticatedUser = await user.toJson() + }) + + it('query Location existing', async () => { + variables = { + place: 'Berlin', + lang: 'en', + } + const result = await query({ query: queryLocations, variables }) + expect(result.data.queryLocations).toEqual([ + { id: 'place.14094307404564380', place_name: 'Berlin, Germany' }, + { id: 'place.15095411613564380', place_name: 'Berlin, Maryland, United States' }, + { id: 'place.5225018734564380', place_name: 'Berlin, Connecticut, United States' }, + { id: 'place.16922023226564380', place_name: 'Berlin, New Jersey, United States' }, + { id: 'place.4035845612564380', place_name: 'Berlin Township, New Jersey, United States' }, + ]) + }) + + it('query Location existing in different language', async () => { + variables = { + place: 'Berlin', + lang: 'de', + } + const result = await query({ query: queryLocations, variables }) + expect(result.data.queryLocations).toEqual([ + { id: 'place.14094307404564380', place_name: 'Berlin, Deutschland' }, + { id: 'place.15095411613564380', place_name: 'Berlin, Maryland, Vereinigte Staaten' }, + { id: 'place.16922023226564380', place_name: 'Berlin, New Jersey, Vereinigte Staaten' }, + { id: 'place.10735893248465990', place_name: 'Berlin Heights, Ohio, Vereinigte Staaten' }, + { id: 'place.1165756679564380', place_name: 'Berlin, Massachusetts, Vereinigte Staaten' }, + ]) + }) + + it('query Location not existing', async () => { + variables = { + place: 'GbHtsd4sdHa', + lang: 'en', + } + const result = await query({ query: queryLocations, variables }) + expect(result.data.queryLocations).toEqual([]) + }) + + it('query Location without a place name given', async () => { + variables = { + place: '', + lang: 'en', + } + const result = await query({ query: queryLocations, variables }) + expect(result.data.queryLocations).toEqual([]) + }) +}) + describe('userMiddleware', () => { describe('UpdateUser', () => { let user @@ -95,7 +165,7 @@ describe('userMiddleware', () => { authenticatedUser = await user.toJson() }) - it('creates a Location node with localised city/state/country names', async () => { + it('creates a Location node with localized city/state/country names', async () => { variables = { ...variables, id: 'updating-user', diff --git a/backend/src/schema/types/Location.gql b/backend/src/schema/types/type/Location.gql similarity index 58% rename from backend/src/schema/types/Location.gql rename to backend/src/schema/types/type/Location.gql index 78bc07656..fad24cc26 100644 --- a/backend/src/schema/types/Location.gql +++ b/backend/src/schema/types/type/Location.gql @@ -16,3 +16,13 @@ type Location { parent: Location @cypher(statement: "MATCH (this)-[:IS_IN]->(l:Location) RETURN l") } +# This is not smart - we need one location for everything - use the same type everywhere! +type LocationMapBox { + id: ID! + place_name: String! +} + +type Query { + queryLocations(place: String!, lang: String!): [LocationMapBox]! +} + diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 5c0280667..8d1bb96f2 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -11,7 +11,7 @@ services: environment: - NODE_ENV="development" # - DEBUG=true - # - NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/` + - NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/` volumes: # This makes sure the docker container has its own node modules. # Therefore it is possible to have a different node version on the host machine diff --git a/docker-compose.test.yml b/docker-compose.test.yml new file mode 100644 index 000000000..2d382d606 --- /dev/null +++ b/docker-compose.test.yml @@ -0,0 +1,47 @@ +version: "3.4" + +services: + ######################################################## + # WEBAPP ############################################### + ######################################################## + webapp: + image: ocelotsocialnetwork/webapp:test + build: + target: test + environment: + - NODE_ENV="test" + + ######################################################## + # BACKEND ############################################## + ######################################################## + backend: + image: ocelotsocialnetwork/backend:test + build: + target: test + environment: + - NODE_ENV="test" + + ######################################################## + # NEO4J ################################################ + ######################################################## + neo4j: + image: ocelotsocialnetwork/neo4j:community + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## + maintenance: + image: ocelotsocialnetwork/maintenance:test + + ######################################################## + # MAILSERVER TO FAKE SMTP ############################## + ######################################################## + mailserver: + image: djfarrelly/maildev + ports: + - 1080:80 + networks: + - external-net +volumes: + webapp_node_modules: + backend_node_modules: diff --git a/webapp/.env.template b/webapp/.env.template index 198452e27..1acad49b4 100644 --- a/webapp/.env.template +++ b/webapp/.env.template @@ -1,4 +1,3 @@ -MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g" SENTRY_DSN_WEBAPP= COMMIT= PUBLIC_REGISTRATION=false diff --git a/webapp/Dockerfile b/webapp/Dockerfile index a82e51f94..bf13d1db2 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -68,6 +68,14 @@ RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build RUN yarn run build +################################################################################## +# TEST ########################################################################### +################################################################################## +FROM build as test + +# Run command +CMD /bin/sh -c "yarn run dev" + ################################################################################## # PRODUCTION (Does contain only "binary"- and static-files to reduce image size) # ################################################################################## diff --git a/webapp/components/FilterMenu/FilterMenu.vue b/webapp/components/FilterMenu/FilterMenu.vue index f46f89607..94d950689 100644 --- a/webapp/components/FilterMenu/FilterMenu.vue +++ b/webapp/components/FilterMenu/FilterMenu.vue @@ -14,9 +14,6 @@
@@ -26,17 +23,11 @@ import Dropdown from '~/components/Dropdown' import { mapGetters } from 'vuex' import FollowingFilter from './FollowingFilter' -import CategoriesFilter from './CategoriesFilter' -import EmotionsFilter from './EmotionsFilter' -import LanguagesFilter from './LanguagesFilter' export default { components: { Dropdown, FollowingFilter, - CategoriesFilter, - EmotionsFilter, - LanguagesFilter, }, props: { placement: { type: String }, diff --git a/webapp/components/ImageUploader/ImageUploader.spec.js b/webapp/components/ImageUploader/ImageUploader.spec.js index ed3ecb1f9..537febac3 100644 --- a/webapp/components/ImageUploader/ImageUploader.spec.js +++ b/webapp/components/ImageUploader/ImageUploader.spec.js @@ -27,11 +27,18 @@ describe('ImageUploader.vue', () => { beforeEach(() => jest.useFakeTimers()) const message = 'File upload failed' const fileError = { status: 'error' } + const unSupportedFileMessage = + 'Please upload an image of file format : JPG , JPEG , PNG or GIF' it('shows an error toaster when verror is called', () => { wrapper.vm.onDropzoneError(fileError, message) expect(mocks.$toast.error).toHaveBeenCalledWith(fileError.status, message) }) + + it('shows an error toaster when unSupported file is uploaded', () => { + wrapper.vm.onUnSupportedFormat(fileError.status, unSupportedFileMessage) + expect(mocks.$toast.error).toHaveBeenCalledWith(fileError.status, unSupportedFileMessage) + }) }) }) }) diff --git a/webapp/components/ImageUploader/ImageUploader.vue b/webapp/components/ImageUploader/ImageUploader.vue index a02b822ae..d4f402e02 100644 --- a/webapp/components/ImageUploader/ImageUploader.vue +++ b/webapp/components/ImageUploader/ImageUploader.vue @@ -65,6 +65,7 @@ export default { url: () => '', maxFilesize: 5.0, previewTemplate: '', + acceptedFiles: '.png,.jpg,.jpeg,.gif', }, cropper: null, file: null, @@ -76,7 +77,20 @@ export default { onDropzoneError(file, message) { this.$toast.error(file.status, message) }, + + onUnSupportedFormat(status, message) { + this.$toast.error(status, message) + }, initCropper(file) { + const supportedFormats = ['image/jpg', 'image/jpeg', 'image/png', 'image/gif'] + + if (supportedFormats.indexOf(file.type) < 0) { + this.onUnSupportedFormat( + 'error', + this.$t('contribution.teaserImage.errors.unSupported-file-format'), + ) + return + } this.showCropper = true this.file = file diff --git a/webapp/components/PostTeaser/PostTeaser.vue b/webapp/components/PostTeaser/PostTeaser.vue index 1626f66a2..6b768c365 100644 --- a/webapp/components/PostTeaser/PostTeaser.vue +++ b/webapp/components/PostTeaser/PostTeaser.vue @@ -23,18 +23,7 @@