Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Refactor Content report (#562)
Olga Bulat1630345e0927
diff --git a/package.json b/package.jsonindex b6b23fe77..26ded254b 100644--- a/package.json+++ b/package.json@@ -46,7 +46,7 @@"@nuxtjs/redirect-module": "^0.3.1","@nuxtjs/sentry": "^5.1.5","@nuxtjs/sitemap": "^2.4.0",- "@nuxtjs/svg": "^0.1.12",+ "@nuxtjs/svg": "^0.3.0","axios": "^0.21.2","axios-mock-adapter": "^1.20.0","babel-core": "^7.0.0-bridge.0",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex bdfc33ed6..25fba7bbc 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -15,7 +15,7 @@ specifiers:'@nuxtjs/sitemap': ^2.4.0'@nuxtjs/storybook': ^4.1.1'@nuxtjs/style-resources': ^1.0.0- '@nuxtjs/svg': ^0.1.12+ '@nuxtjs/svg': ^0.3.0'@playwright/test': ^1.16.2'@testing-library/jest-dom': ^5.14.1'@testing-library/user-event': ^13.2.1@@ -80,7 +80,7 @@ dependencies:'@nuxtjs/redirect-module': 0.3.1'@nuxtjs/sentry': 5.1.6'@nuxtjs/sitemap': 2.4.0- '@nuxtjs/svg': 0.1.12+ '@nuxtjs/svg': 0.3.0axios: 0.21.4axios-mock-adapter: [email protected]babel-core: 7.0.0-bridge.0@@ -3452,11 +3452,12 @@ packages:sass-resources-loader: 2.2.4dev: true- /@nuxtjs/svg/0.1.12:- resolution: {integrity: sha512-QJjArXOcQzDn7gzc/pFr960NTediubeZ5djtqV3BkOnZnANSOvtxFp2LnHF6e4rFq9CTEabPr89WZUwrVDemEQ==}+ /@nuxtjs/svg/0.3.0:+ resolution: {integrity: sha512-eokmEiDYE6bZR6FNUQ6VlOnck1Z2lfxlZUv56JNXXSpD6SR6qvfxmQYgTuxD++7//LcsRSqBOb54EL+ebwnDRQ==}dependencies:file-loader: 6.2.0raw-loader: 4.0.2+ svg-sprite-loader: 5.2.1url-loader: [email protected]vue-svg-loader: 0.16.0transitivePeerDependencies:@@ -7657,7 +7658,6 @@ packages:/clone/2.1.2:resolution: {integrity: sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=}engines: {node: '>=0.8'}- dev: true/clsx/1.1.1:resolution: {integrity: sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==}@@ -8518,6 +8518,11 @@ packages:resolution: {integrity: sha512-b+QLs5vHgS+IoSNcUE4n9HP2NwcHj7aqnJWsjPtuG75Rh5TOaGt0OjAYInh77d5T16V5cRDC+Pw/6ZZZiETBGw==}dev: true+ /deepmerge/1.3.2:+ resolution: {integrity: sha1-FmNpFinU2/42T6EqKk8KqGqjoFA=}+ engines: {node: '>=0.10.0'}+ dev: false+/deepmerge/4.2.2:resolution: {integrity: sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==}engines: {node: '>=0.10.0'}@@ -8751,12 +8756,22 @@ packages:webidl-conversions: 5.0.0dev: true+ /domhandler/2.4.2:+ resolution: {integrity: sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==}+ dependencies:+ domelementtype: 1.3.1+ dev: false+/domhandler/4.3.0:resolution: {integrity: sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==}engines: {node: '>= 4'}dependencies:domelementtype: 2.2.0+ /domready/1.0.8:+ resolution: {integrity: sha1-kfJS5Ze2Wvd+dFriTdAYXV4m1Yw=}+ dev: false+/domutils/1.7.0:resolution: {integrity: sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==}dependencies:@@ -8968,6 +8983,10 @@ packages:ansi-colors: 4.1.1dev: true+ /entities/1.1.2:+ resolution: {integrity: sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==}+ dev: false+/entities/2.2.0:resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==}@@ -10353,6 +10372,11 @@ packages:/has-bigints/1.0.1:resolution: {integrity: sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==}+ /has-flag/1.0.0:+ resolution: {integrity: sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=}+ engines: {node: '>=0.10.0'}+ dev: false+/has-flag/3.0.0:resolution: {integrity: sha1-tdRU3CGZriJWmfNGfloH87lVuv0=}engines: {node: '>=4'}@@ -10606,6 +10630,17 @@ packages:util.promisify: 1.0.0webpack: 4.46.0+ /htmlparser2/3.10.1:+ resolution: {integrity: sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==}+ dependencies:+ domelementtype: 1.3.1+ domhandler: 2.4.2+ domutils: 1.7.0+ entities: 1.1.2+ inherits: 2.0.4+ readable-stream: 3.6.0+ dev: false+/htmlparser2/6.1.0:resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==}dependencies:@@ -10708,6 +10743,12 @@ packages:resolution: {integrity: sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==}engines: {node: '>= 4'}+ /image-size/0.5.5:+ resolution: {integrity: sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=}+ engines: {node: '>=0.10.0'}+ hasBin: true+ dev: false+/immediate/3.0.6:resolution: {integrity: sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=}dev: false@@ -11871,6 +11912,10 @@ packages:resolution: {integrity: sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==}dev: true+ /js-base64/2.6.4:+ resolution: {integrity: sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==}+ dev: false+/js-beautify/1.14.0:resolution: {integrity: sha512-yuck9KirNSCAwyNJbqW+BxJqJ0NLJ4PwBUzQQACl5O3qHMBXVkXb/rD0ilh/Lat/tn88zSZ+CAHOlk0DsY7GuQ==}engines: {node: '>=10'}@@ -12595,6 +12640,13 @@ packages:resolution: {integrity: sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=}dev: true+ /merge-options/1.0.1:+ resolution: {integrity: sha512-iuPV41VWKWBIOpBsjoxjDZw8/GbSfZ2mk7N1453bwMrfzdrIk7EzBd+8UVR6rkw67th7xnk9Dytl3J+lHPdxvg==}+ engines: {node: '>=4'}+ dependencies:+ is-plain-obj: 1.1.0+ dev: false+/merge-source-map/1.1.0:resolution: {integrity: sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==}dependencies:@@ -12616,6 +12668,25 @@ packages:resolution: {integrity: sha512-jo1OfR4TaEwd5HOrt5+tAZ9mqT4jmpNAusXtyfNzqVm9uiSYFZlKM1wYL4oU7azZW/PxQW53wM0S6OR1JHNa2g==}dev: true+ /micromatch/3.1.0:+ resolution: {integrity: sha512-3StSelAE+hnRvMs8IdVW7Uhk8CVed5tp+kLLGlBP6WiRAXS21GPGu/Nat4WNPXj2Eoc24B02SaeoyozPMfj0/g==}+ engines: {node: '>=0.10.0'}+ dependencies:+ arr-diff: 4.0.0+ array-unique: 0.3.2+ braces: 2.3.2+ define-property: 1.0.0+ extend-shallow: 2.0.1+ extglob: 2.0.4+ fragment-cache: 0.2.1+ kind-of: 5.1.0+ nanomatch: 1.2.13+ object.pick: 1.3.0+ regex-not: 1.0.2+ snapdragon: 0.8.2+ to-regex: 3.0.2+ dev: false+/micromatch/3.1.10:resolution: {integrity: sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==}engines: {node: '>=0.10.0'}@@ -12753,6 +12824,10 @@ packages:stream-each: 1.2.3through2: 2.0.5+ /mitt/1.1.2:+ resolution: {integrity: sha1-OA5hSA1qYVtmDwertg1R4KTkvtY=}+ dev: false+/mixin-deep/1.3.2:resolution: {integrity: sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==}engines: {node: '>=0.10.0'}@@ -14281,6 +14356,14 @@ packages:postcss-values-parser: 2.0.1dev: false+ /postcss-prefix-selector/[email protected]:+ resolution: {integrity: sha512-8d5fiBQZWMtGWH/7ewEeo6RnBNyT2kLD5wTIfV2oHYqH4hjiofg/rP5X3SUwnqOINzE4mM/K/UOAiNrIaKzd4w==}+ peerDependencies:+ postcss: 7.x || 8.x+ dependencies:+ postcss: 5.2.18+ dev: false+/postcss-preset-env/6.7.0:resolution: {integrity: sha512-eU4/K5xzSFwUFJ8hTdTQzo2RBLbDVt83QZrAvI07TULOkmyQlnYlpwep+2yIK+K+0KlZO4BvFcleOCCcUtwchg==}engines: {node: '>=6.0.0'}@@ -14454,6 +14537,16 @@ packages:uniq: 1.0.1dev: false+ /postcss/5.2.18:+ resolution: {integrity: sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==}+ engines: {node: '>=0.12'}+ dependencies:+ chalk: 1.1.3+ js-base64: 2.6.4+ source-map: 0.5.7+ supports-color: 3.2.3+ dev: false+/postcss/7.0.39:resolution: {integrity: sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==}engines: {node: '>=6.0.0'}@@ -14469,6 +14562,41 @@ packages:picocolors: 1.0.0source-map-js: 1.0.1+ /posthtml-parser/0.2.1:+ resolution: {integrity: sha1-NdUw3jhnQMK6JP8usvrznM3ycd0=}+ dependencies:+ htmlparser2: 3.10.1+ isobject: 2.1.0+ dev: false++ /posthtml-rename-id/1.0.12:+ resolution: {integrity: sha512-UKXf9OF/no8WZo9edRzvuMenb6AD5hDLzIepJW+a4oJT+T/Lx7vfMYWT4aWlGNQh0WMhnUx1ipN9OkZ9q+ddEw==}+ dependencies:+ escape-string-regexp: 1.0.5+ dev: false++ /posthtml-render/1.4.0:+ resolution: {integrity: sha512-W1779iVHGfq0Fvh2PROhCe2QhB8mEErgqzo1wpIt36tCgChafP+hbXIhLDOM8ePJrZcFs0vkNEtdibEWVqChqw==}+ engines: {node: '>=10'}+ dev: false++ /posthtml-svg-mode/1.0.3:+ resolution: {integrity: sha512-hEqw9NHZ9YgJ2/0G7CECOeuLQKZi8HjWLkBaSVtOWjygQ9ZD8P7tqeowYs7WrFdKsWEKG7o+IlsPY8jrr0CJpQ==}+ dependencies:+ merge-options: 1.0.1+ posthtml: 0.9.2+ posthtml-parser: 0.2.1+ posthtml-render: 1.4.0+ dev: false++ /posthtml/0.9.2:+ resolution: {integrity: sha1-9MBtufZ7Yf0XxOJW5+PZUVv3Jv0=}+ engines: {node: '>=0.10.0'}+ dependencies:+ posthtml-parser: 0.2.1+ posthtml-render: 1.4.0+ dev: false+/prelude-ls/1.1.2:resolution: {integrity: sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=}engines: {node: '>= 0.8.0'}@@ -16481,6 +16609,13 @@ packages:resolution: {integrity: sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=}engines: {node: '>=0.8.0'}+ /supports-color/3.2.3:+ resolution: {integrity: sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=}+ engines: {node: '>=0.8.0'}+ dependencies:+ has-flag: 1.0.0+ dev: false+/supports-color/5.5.0:resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}engines: {node: '>=4'}@@ -16508,6 +16643,46 @@ packages:supports-color: 7.2.0dev: true+ /svg-baker-runtime/1.4.7:+ resolution: {integrity: sha512-Zorfwwj5+lWjk/oxwSMsRdS2sPQQdTmmsvaSpzU+i9ZWi3zugHLt6VckWfnswphQP0LmOel3nggpF5nETbt6xw==}+ dependencies:+ deepmerge: 1.3.2+ mitt: 1.1.2+ svg-baker: 1.7.0+ dev: false++ /svg-baker/1.7.0:+ resolution: {integrity: sha512-nibslMbkXOIkqKVrfcncwha45f97fGuAOn1G99YwnwTj8kF9YiM6XexPcUso97NxOm6GsP0SIvYVIosBis1xLg==}+ dependencies:+ bluebird: 3.7.2+ clone: 2.1.2+ he: 1.2.0+ image-size: 0.5.5+ loader-utils: 1.4.0+ merge-options: 1.0.1+ micromatch: 3.1.0+ postcss: 5.2.18+ postcss-prefix-selector: [email protected]+ posthtml-rename-id: 1.0.12+ posthtml-svg-mode: 1.0.3+ query-string: 4.3.4+ traverse: 0.6.6+ dev: false++ /svg-sprite-loader/5.2.1:+ resolution: {integrity: sha512-n2IZc87rpOeXh+PQFksFMGCfMV/BT01YG+Dlbyjoh2Cz8BSTL5Vi/7KDr86Pt/u1NRDCVb3vY74BF5rKCmqbNA==}+ engines: {node: '>=6'}+ dependencies:+ bluebird: 3.7.2+ deepmerge: 1.3.2+ domready: 1.0.8+ escape-string-regexp: 1.0.5+ loader-utils: 1.4.0+ svg-baker: 1.7.0+ svg-baker-runtime: 1.4.7+ url-slug: 2.0.0+ dev: false+/svg-tags/1.0.0:resolution: {integrity: sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=}dev: false@@ -16912,6 +17087,10 @@ packages:punycode: 2.1.1dev: true+ /traverse/0.6.6:+ resolution: {integrity: sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=}+ dev: false+/trim-trailing-lines/1.1.4:resolution: {integrity: sha512-rjUWSqnfTNrjbB9NQWfPMH/xRK1deHeGsHoVfpxJ++XeYXE0d6B1En37AHfw3jtfTU7dzMzZL2jjpe8Qb5gLIQ==}dev: true@@ -17127,6 +17306,11 @@ packages:resolution: {integrity: sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==}engines: {node: '>=4'}+ /unidecode/0.1.8:+ resolution: {integrity: sha1-77swFTi8RSRqmsjFWdcvAVMFBT4=}+ engines: {node: '>= 0.4.12'}+ dev: false+/unified/9.2.0:resolution: {integrity: sha512-vx2Z0vY+a3YoTj8+pttM3tiJHCwY5UFbYdiWrwBEbHmK8pvsPj2rtAX2BFfgXen8T39CJWblWRDT4L5WGXtDdg==}dependencies:@@ -17290,6 +17474,12 @@ packages:schema-utils: 3.1.1webpack: 4.46.0+ /url-slug/2.0.0:+ resolution: {integrity: sha1-p4nVrtSZXA2VrzM3etHVxo1NcCc=}+ dependencies:+ unidecode: 0.1.8+ dev: false+/url/0.11.0:resolution: {integrity: sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=}dependencies:diff --git a/src/assets/icons/chevron-left.svg b/src/assets/icons/chevron-left.svgnew file mode 100644index 000000000..7d2918241--- /dev/null+++ b/src/assets/icons/chevron-left.svg@@ -0,0 +1,5 @@+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+ <g id="icon">+ <path fill-rule="evenodd" clip-rule="evenodd" d="M13.445 18.0045L7.98638 12L13.445 5.99553L14.5549 7.00454L10.0136 12L14.5549 16.9955L13.445 18.0045Z" fill="currentColor"/>+ </g>+</svg>diff --git a/src/assets/icons/close.svg b/src/assets/icons/close.svgindex b4c834c83..633077a3e 100644--- a/src/assets/icons/close.svg+++ b/src/assets/icons/close.svg@@ -1,5 +1,5 @@-<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g id="icon" fill="currentColor">- <path d="M12 13.0607L15.7123 16.773L16.773 15.7123L13.0607 12L16.773 8.28772L15.7123 7.22706L12 10.9394L8.2877 7.22705L7.22704 8.28771L10.9394 12L7.22704 15.7123L8.2877 16.773L12 13.0607Z"/>+ <path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" /></g></svg>diff --git a/src/assets/icons/flag.svg b/src/assets/icons/flag.svgnew file mode 100644index 000000000..d790756ac--- /dev/null+++ b/src/assets/icons/flag.svg@@ -0,0 +1,5 @@+<svg fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">+ <g id="icon">+ <path clip-rule="evenodd" d="m4.5 4h9l.4 2h5.6v10h-7l-.4-2h-5.6v7h-2zm7.76 4-.4-2h-5.36v6h7.24l.4 2h3.36v-6z" fill="currentColor" fill-rule="evenodd"/>+ </g>+</svg>diff --git a/src/components/ContentReport/ContentReportForm.vue b/src/components/ContentReport/ContentReportForm.vuedeleted file mode 100644index c487dfce7..000000000--- a/src/components/ContentReport/ContentReportForm.vue+++ /dev/null@@ -1,162 +0,0 @@-<template>- <div id="content-report-form" class="p-4 arrow-popup">- <button- :aria-label="$t('photo-details.aria.close-form')"- class="button close-button is-text tiny float-right block bg-white"- @click="closeForm()"- @keyup.enter="closeForm()"- >- <i class="icon cross" />- </button>- <DmcaNotice- v-if="selectedCopyright"- :image-u-r-l="image.url"- :provider-name="providerName"- :dmca-form-url="dmcaFormUrl"- @onBackClick="onBackClick()"- />- <DoneMessage- v-else-if="!selectedCopyright && isReportSent"- :image-u-r-l="image.url"- :provider-name="providerName"- />- <ReportError v-else-if="reportFailed" />-- <OtherIssueForm- v-else-if="selectedOther"- @onBackClick="onBackClick()"- @sendContentReport="sendContentReport"- />- <form v-else>- <h5 class="b-header mb-4">- {{ $t('photo-details.content-report.title') }}- </h5>- <fieldset class="mb-4">- <legend class="mb-4">- {{ $t('photo-details.content-report.issue') }}- </legend>-- <div>- <label for="dmca" class="ms-2">- <input- id="dmca"- v-model="selectedReason"- type="radio"- name="type"- value="dmca"- />- {{ $t('photo-details.content-report.copyright') }}- </label>- </div>-- <div>- <label for="mature" class="ms-2">- <input- id="mature"- v-model="selectedReason"- type="radio"- name="type"- value="mature"- />- {{ $t('photo-details.content-report.mature') }}- </label>- </div>-- <div>- <label for="other" class="ms-2">- <input- id="other"- v-model="selectedReason"- type="radio"- name="type"- value="other"- />- {{ $t('photo-details.content-report.other') }}- </label>- </div>- </fieldset>-- <p class="caption font-semibold text-gray mb-4">- {{ $t('photo-details.content-report.caption') }}- </p>-- <button- type="button"- :disabled="selectedReason === null"- class="button next-button tiny is-success float-right"- @click="onIssueSelected()"- @keyup.enter="onIssueSelected()"- >- {{ $t('photo-details.content-report.next') }}- </button>- </form>- </div>-</template>--<script>-import getProviderName from '~/utils/get-provider-name'-import dmcaNotice from './DmcaNotice'-import OtherIssueForm from './OtherIssueForm'-import DoneMessage from './DoneMessage'-import ReportError from './ReportError'-import { SEND_CONTENT_REPORT } from '~/constants/action-types'-import { REPORT_FORM_CLOSED } from '~/constants/mutation-types'-import { PROVIDER, REPORT_CONTENT } from '~/constants/store-modules'-import { mapActions, mapMutations, mapState } from 'vuex'--const dmcaFormUrl =- 'https://docs.google.com/forms/d/e/1FAIpQLSd0I8GsEbGQLdaX4K_F6V2NbHZqN137WMZgnptUpzwd-kbDKA/viewform'--export default {- name: 'ContentReportForm',- components: {- DoneMessage,- dmcaNotice,- ReportError,- OtherIssueForm,- },- props: ['image'],- data() {- return {- selectedReason: null,- selectedOther: false,- selectedCopyright: false,- dmcaFormUrl,- }- },- computed: {- ...mapState(REPORT_CONTENT, ['isReportSent', 'reportFailed']),- ...mapState(PROVIDER, ['imageProviders']),- providerName() {- return getProviderName(this.imageProviders, this.image.provider)- },- },- methods: {- ...mapActions(REPORT_CONTENT, { sendReport: SEND_CONTENT_REPORT }),- ...mapMutations(REPORT_CONTENT, { closeReportForm: REPORT_FORM_CLOSED }),- onIssueSelected() {- if (this.selectedReason === 'other') {- this.selectedOther = true- } else if (this.selectedReason === 'dmca') {- this.selectedCopyright = true- } else {- this.sendContentReport()- }- },- onBackClick() {- this.selectedOther = false- this.selectedCopyright = false- },- sendContentReport(description = '') {- this.sendReport({- identifier: this.$props.image.id,- reason: this.selectedReason,- description,- })- },- closeForm() {- this.closeReportForm- },- },-}-</script>diff --git a/src/components/ContentReport/DmcaNotice.vue b/src/components/ContentReport/DmcaNotice.vuedeleted file mode 100644index baa860860..000000000--- a/src/components/ContentReport/DmcaNotice.vue+++ /dev/null@@ -1,62 +0,0 @@-<template>- <div>- <i18n- path="photo-details.content-report.dmca.content"- tag="p"- class="block px-6 mt-10 text-center"- >- <template #link>- <a- :aria-label="$t('photo-details.aria.dmca')"- :href="dmcaFormUrl"- target="_blank"- rel="noopener"- >{{ $t('photo-details.content-report.dmca.link') }}</a- >- </template>- </i18n>-- <i18n- path="photo-details.content-report.dmca.provider"- tag="p"- class="block px-6 mt-4 text-center"- >- <template #link>- <a- :aria-label="- $t('photo-details.aria.provider-report-form', {- provider: providerName,- })- "- :href="imageURL"- target="_blank"- rel="noopener"- >{{ providerName }}</a- >- </template>- </i18n>-- <button- class="button is-text tiny mt-4"- @click="onBackClick()"- @keyup.enter="onBackClick()"- >- <span- ><i class="icon chevron-left me-2" />- {{ $t('photo-details.content-report.back') }}</span- >- </button>- </div>-</template>--<script>-export default {- name: 'DmcaNotice',- props: ['dmcaFormUrl', 'imageURL', 'providerName'],- methods: {- onBackClick() {- this.$emit('onBackClick')- },- },-}-</script>diff --git a/src/components/ContentReport/OtherIssueForm.vue b/src/components/ContentReport/OtherIssueForm.vuedeleted file mode 100644index fa5416280..000000000--- a/src/components/ContentReport/OtherIssueForm.vue+++ /dev/null@@ -1,72 +0,0 @@-<template>- <form class="other-form">- <h4 class="b-header">- {{ $t('photo-details.content-report.title') }}- </h4>- <legend class="mb-2">- {{ $t('photo-details.content-report.issue-description') }}- </legend>- <label for="issue">- <textarea- id="issue"- v-model="otherReasonDescription"- class="reason p-2 font-semibold"- placeholder="Issue description required (with at least 20 characters)"- />- </label>- <div>- <button- class="button other-back-button is-text tiny mt-4 bg-white"- @click="onBackClick()"- @keyup.enter="onBackClick()"- >- <span>- <i class="icon chevron-left me-2" />- {{ $t('photo-details.content-report.back') }}- </span>- </button>-- <button- type="button"- :disabled="!descriptionHasMoreThan20Chars"- class="button submit-other-button tiny is-success mt-4 float-right"- @click="sendContentReport()"- @keyup.enter="sendContentReport()"- >- {{ $t('photo-details.content-report.submit') }}- </button>- </div>- </form>-</template>--<script>-export default {- name: 'OtherIssueForm',- data() {- return {- otherReasonDescription: '',- }- },- computed: {- descriptionHasMoreThan20Chars() {- return this.otherReasonDescription.length >= 20- },- },- methods: {- onBackClick() {- this.$emit('onBackClick')- },- sendContentReport() {- this.$emit('sendContentReport', this.otherReasonDescription)- },- },-}-</script>--<style lang="scss" scoped>-.reason {- width: 100%;- height: 6rem;- font-size: 13px;-}-</style>diff --git a/src/components/ContentReport/ReportError.vue b/src/components/ContentReport/ReportError.vuedeleted file mode 100644index f4033d39a..000000000--- a/src/components/ContentReport/ReportError.vue+++ /dev/null@@ -1,31 +0,0 @@-<template>- <div>- <span class="block px-6 mt-10 text-center">- {{ $t('photo-details.content-report.dmca.submission-error') }}- </span>- <button- class="button is-text tiny mt-4"- @click="onBackClick()"- @keyup.enter="onBackClick()"- >- <span>- <i class="icon chevron-left me-2" />- {{ $t('photo-details.content-report.back') }}- </span>- </button>- </div>-</template>--<script>-import { BACK_TO_REPORT_START } from '~/constants/mutation-types'-import { REPORT_CONTENT } from '~/constants/store-modules'--export default {- name: 'ReportError',- methods: {- onBackClick() {- this.$store.commit(`${REPORT_CONTENT}/${BACK_TO_REPORT_START}`)- },- },-}-</script>diff --git a/src/components/ImageDetails/ImageAttribution.vue b/src/components/ImageDetails/ImageAttribution.vueindex d4902d2b8..0690dad73 100644--- a/src/components/ImageDetails/ImageAttribution.vue+++ b/src/components/ImageDetails/ImageAttribution.vue@@ -17,9 +17,15 @@<script>import attributionHtml from '~/utils/attribution-html'+import CopyLicense from '~/components/MediaInfo/CopyLicense.vue'+import MediaLicense from '~/components/MediaInfo/MediaLicense.vue'export default {name: 'ImageAttribution',+ components: {+ CopyLicense,+ MediaLicense,+ },props: {image: {type: Object,diff --git a/src/components/ImageDetails/PhotoDetails.vue b/src/components/ImageDetails/PhotoDetails.vuedeleted file mode 100644index c892ac0a3..000000000--- a/src/components/ImageDetails/PhotoDetails.vue+++ /dev/null@@ -1,278 +0,0 @@-<template>- <div class="photo columns is-desktop px-6 md:px-14 pb-16">- <div class="column is-three-fifths photo_image-ctr mt-4">- <a- v-if="shouldShowBreadcrumb"- class="block photo_breadcrumb text-left ms-4 mb-4 lg:ms-0 text-dark-gray font-semibold caption"- :href="breadCrumbURL"- @click.prevent="onGoBackToSearchResults"- @keyup.enter.prevent="onGoBackToSearchResults"- >- <i class="icon chevron-left me-2" />- {{ $t('photo-details.back') }}- </a>-- <img- v-show="!sketchFabUid"- :class="{ photo_image: true, loading: !isLoaded }"- :src="imgUrl"- :alt="image.title"- @load="onImageLoad"- />-- <SketchFabViewer- v-if="sketchFabUid"- :uid="sketchFabUid"- @failure="sketchFabfailure = true"- />-- <div class="mt-4 mb-2 ms-4 lg:ms-0">- <p class="caption text-left text-dark-gray">- {{ $t('photo-details.legal-disclaimer') }}- </p>- </div>-- <div class="mb-1 text-left">- <button- type="button"- class="button is-text tiny p-0 report mt-2"- @click="toggleReportFormVisibility"- >- <span class="text-trans-blue ms-2 text-sm">- <i class="icon flag" />- {{ $t('photo-details.content-report.title') }}- </span>- </button>- </div>- <ContentReportForm- v-if="isReportFormVisible"- :image="image"- data-testid="content-report-form"- class="mt-2 text-left"- />- </div>- <div- role="region"- :aria-label="$t('photo-details.aria.details')"- class="column image-info md:ms-10"- >- <div class="my-4">- <h1 class="text-6xl">- {{ image.title }}- </h1>- <i18n- v-if="image.creator"- class="caption"- path="photo-details.creator"- tag="span"- >- <template #name>- <a- v-if="image.creator_url"- :aria-label="- $t('photo-details.aria.creator-url', { creator: image.creator })- "- :href="image.creator_url"- @click="onPhotoCreatorLinkClicked"- @keyup.enter="onPhotoCreatorLinkClicked"- >- {{ image.creator }}- </a>- <span v-else>{{ image.creator }}</span>- </template>- </i18n>- </div>- <section class="tabs">- <div role="tablist" :aria-label="$t('photo-details.aria.details')">- <button- id="reuse"- role="tab"- aria-controls="tab-reuse"- :aria-selected="activeTab === 0"- :class="tabClass(0, 'tab')"- @click.prevent="setActiveTab(0)"- @keyup.enter.prevent="setActiveTab(0)"- >- {{ $t('photo-details.reuse.title') }}- </button>- <button- id="information"- role="tab"- aria-controls="tab-information"- :aria-selected="activeTab === 1"- :class="tabClass(1, 'tab')"- @click.prevent="setActiveTab(1)"- @keyup.enter.prevent="setActiveTab(1)"- >- {{ $t('photo-details.information.title') }}- </button>- </div>-- <div- id="tab-reuse"- role="tabpanel"- aria-labelledby="reuse"- tabindex="0"- :class="tabClass(0, 'tabs-panel')"- >- <ImageAttribution- data-testid="image-attribution"- :image="image"- :license-url="licenseUrl"- :full-license-name="fullLicenseName"- />- </div>- <div- id="tab-information"- role="tabpanel"- aria-labelledby="information"- tabindex="0"- :class="tabClass(1, 'tabs-panel')"- >- <ImageInfo- data-testid="image-info"- :image="image"- :license-url="licenseUrl"- :full-license-name="fullLicenseName"- :image-width="imageWidth"- :image-height="imageHeight"- :image-type="imageType"- />- </div>- </section>-- <a- data-testid="source-button"- :href="image.foreign_landing_url"- target="_blank"- rel="noopener"- class="button is-success mb-2 mt-4"- @click="onPhotoSourceLinkClicked"- @keyup.enter="onPhotoSourceLinkClicked"- >- {{ $t('photo-details.weblink') }}- <i class="icon external-link ms-4 text-base pt-1 text-light-gray" />- </a>-- <ReuseSurvey :image="image" />- </div>- </div>-</template>--<script>-import { TOGGLE_REPORT_FORM_VISIBILITY } from '~/constants/mutation-types'-import {- SEND_DETAIL_PAGE_EVENT,- DETAIL_PAGE_EVENTS,-} from '~/constants/usage-data-analytics-types'-import { getFullLicenseName } from '~/utils/license'-import { REPORT_CONTENT, USAGE_DATA } from '~/constants/store-modules'--export default {- name: 'PhotoDetails',- props: [- 'image',- 'breadCrumbURL',- 'shouldShowBreadcrumb',- 'imageWidth',- 'imageHeight',- 'imageType',- 'thumbnail',- ],- data() {- return {- sketchFabfailure: false,- activeTab: 0,- }- },- computed: {- isReportFormVisible() {- return this.$store.state[REPORT_CONTENT].isReportFormVisible- },- imgUrl() {- return this.image && this.image.url ? this.image.url : this.thumbnail- },- isLoaded() {- return this.image && !!this.image.url- },- sketchFabUid() {- if (this.image.source !== 'sketchfab' || this.sketchFabfailure) {- return null- }-- return this.image.url- .split('https://media.sketchfab.com/models/')[1]- .split('/')[0]- },- fullLicenseName() {- return this.image- ? getFullLicenseName(this.image.license, this.image.license_version)- : ''- },- licenseUrl() {- return `${this.image.license_url}?ref=openverse`- },- },- methods: {- sendEvent(eventType) {- const eventData = {- eventType,- resultUuid: this.$props.image.id,- }- this.$store.dispatch(`${USAGE_DATA}/${SEND_DETAIL_PAGE_EVENT}`, eventData)- },- onGoBackToSearchResults() {- this.$router.back()- },- onImageLoad(event) {- this.$emit('onImageLoaded', event)- },- tabClass(tabIdx, tabClass) {- return {- [tabClass]: true,- 'is-active': tabIdx === this.activeTab,- }- },- setActiveTab(tabIdx) {- this.activeTab = tabIdx- },- toggleReportFormVisibility() {- this.$store.commit(`${REPORT_CONTENT}/${TOGGLE_REPORT_FORM_VISIBILITY}`)- },- onPhotoSourceLinkClicked() {- this.sendEvent(DETAIL_PAGE_EVENTS.SOURCE_CLICKED)- },- onPhotoCreatorLinkClicked() {- this.sendEvent(DETAIL_PAGE_EVENTS.CREATOR_CLICKED)- },- },-}-</script>--<style lang="scss" scoped>-.icon {- vertical-align: middle;-}--.photo_image.loading {- width: 100%;-}--.photo_image-ctr {- overflow: hidden;- text-align: center;-- img {- position: relative;- width: 100%;- height: auto;- max-height: 44rem;- max-width: 100%;- object-fit: contain;- }-}--.tab:first-child {- margin-inline-start: 0;-}-</style>diff --git a/src/components/ImageDetails/VPhotoDetails.vue b/src/components/ImageDetails/VPhotoDetails.vuenew file mode 100644index 000000000..d0b78e5eb--- /dev/null+++ b/src/components/ImageDetails/VPhotoDetails.vue@@ -0,0 +1,323 @@+<template>+ <div class="photo columns is-desktop px-6 md:px-14 pb-16">+ <div class="column is-three-fifths photo_image-ctr mt-4">+ <a+ v-if="shouldShowBreadcrumb"+ class="block photo_breadcrumb text-left ms-4 mb-4 lg:ms-0 text-dark-gray font-semibold caption"+ :href="breadCrumbURL"+ @click.prevent="goBackToSearchResults"+ >+ <VIcon :icon-path="icons.chevronLeft" class="me-2" />+ {{ $t('photo-details.back') }}+ </a>++ <img+ v-show="!sketchFabUid"+ :class="{ photo_image: true, loading: !isLoaded }"+ :src="imgUrl"+ :alt="image.title"+ @load="onImageLoad"+ />++ <SketchFabViewer+ v-if="sketchFabUid"+ :uid="sketchFabUid"+ @failure="sketchFabfailure = true"+ />++ <p class="caption text-left text-dark-gray mt-4 mb-2 ms-4 lg:ms-0">+ {{ $t('photo-details.legal-disclaimer') }}+ </p>++ <VButton+ variant="action-button"+ size="disabled"+ class="report py-2 mt-2"+ @click="reportForm.toggleVisibility"+ >+ {{ $t('photo-details.content-report.title') }}+ <VIcon :icon-path="icons.flag" class="text-trans-blue ms-2 text-sm" />+ </VButton>+ <VContentReportForm+ v-if="isReportFormVisible"+ :image="image"+ :provider-name="providerName"+ data-testid="content-report-form"+ class="mt-2 text-left"+ @close-form="reportForm.close()"+ />+ </div>+ <div+ role="region"+ :aria-label="$t('photo-details.aria.details')"+ class="column image-info md:ms-10"+ >+ <div class="my-4">+ <h1 class="text-6xl">+ {{ image.title }}+ </h1>+ <i18n+ v-if="image.creator"+ class="caption"+ path="photo-details.creator"+ tag="span"+ >+ <template #name>+ <a+ v-if="image.creator_url"+ :aria-label="+ $t('photo-details.aria.creator-url', { creator: image.creator })+ "+ :href="image.creator_url"+ @click="linkClicked.creatorLink"+ >+ {{ image.creator }}+ </a>+ <span v-else>{{ image.creator }}</span>+ </template>+ </i18n>+ </div>+ <section class="tabs">+ <div role="tablist" :aria-label="$t('photo-details.aria.details')">+ <button+ id="reuse"+ role="tab"+ type="button"+ aria-controls="tab-reuse"+ :aria-selected="activeTab === 0"+ :class="tabClass(0, 'tab')"+ @click.prevent="setActiveTab(0)"+ >+ {{ $t('photo-details.reuse.title') }}+ </button>+ <button+ id="information"+ role="tab"+ type="button"+ aria-controls="tab-information"+ :aria-selected="activeTab === 1"+ :class="tabClass(1, 'tab')"+ @click.prevent="setActiveTab(1)"+ >+ {{ $t('photo-details.information.title') }}+ </button>+ </div>+ <div+ id="tab-reuse"+ role="tabpanel"+ aria-labelledby="reuse"+ tabindex="0"+ :class="tabClass(0, 'tabs-panel')"+ >+ <ImageAttribution+ data-testid="image-attribution"+ :image="image"+ :license-url="license.url"+ :full-license-name="license.fullName"+ />+ </div>+ <div+ id="tab-information"+ role="tabpanel"+ aria-labelledby="information"+ tabindex="0"+ :class="tabClass(1, 'tabs-panel')"+ >+ <ImageInfo+ data-testid="image-info"+ :image="image"+ :license-url="license.url"+ :full-license-name="license.fullName"+ :image-width="imageWidth"+ :image-height="imageHeight"+ :image-type="imageType"+ />+ </div>+ </section>++ <a+ data-testid="source-button"+ :href="image.foreign_landing_url"+ target="_blank"+ rel="noopener"+ class="button is-success mb-2 mt-4"+ @click="linkClicked.photoSource"+ >+ {{ $t('photo-details.weblink') }}+ <VIcon+ class="inline ms-4 pt-1 text-base text-light-gray"+ :icon-path="icons.externalLink"+ rtl-flip+ />+ </a>++ <ReuseSurvey :image="image" />+ </div>+ </div>+</template>++<script>+import { computed, ref, useContext } from '@nuxtjs/composition-api'++import { USAGE_DATA } from '~/constants/store-modules'+import {+ SEND_DETAIL_PAGE_EVENT,+ DETAIL_PAGE_EVENTS,+} from '~/constants/usage-data-analytics-types'++import { getFullLicenseName } from '~/utils/license'++import chevronLeft from '~/assets/icons/chevron-left.svg'+import flag from '~/assets/icons/flag.svg'+import externalLink from '~/assets/icons/external-link.svg'++import ReuseSurvey from '~/components/ImageDetails/ReuseSurvey.vue'+import VButton from '~/components/VButton.vue'+import VIcon from '~/components/VIcon/VIcon.vue'+import VContentReportForm from '~/components/VContentReport/VContentReportForm.vue'+import SketchFabViewer from '~/components/SketchFabViewer.vue'+import ImageInfo from '~/components/ImageDetails/ImageInfo.vue'+import ImageAttribution from '~/components/ImageDetails/ImageAttribution.vue'++export default {+ name: 'VPhotoDetails',+ components: {+ ImageAttribution,+ ImageInfo,+ ReuseSurvey,+ SketchFabViewer,+ VButton,+ VIcon,+ VContentReportForm,+ },+ props: [+ 'image',+ 'breadCrumbURL',+ 'shouldShowBreadcrumb',+ 'imageWidth',+ 'imageHeight',+ 'imageType',+ 'thumbnail',+ ],+ setup(props, { emit }) {+ const { router, store } = useContext()+ const sketchFabfailure = ref(false)+ const activeTab = ref(0)+ const isReportFormVisible = ref(false)++ const imgUrl = computed(() => {+ return isLoaded.value ? props.image.url : props.thumbnail+ })+ const isLoaded = computed(() => props.image && !!props.image.url)+ const providerName = computed(() => {+ return props.image+ ? store.getters['provider/getProviderName'](props.image.provider)+ : ''+ })+ /** @type {ComputedRef<null|string>} */+ const sketchFabUid = computed(() => {+ if (props.image.source !== 'sketchfab' || this.sketchFabfailure) {+ return null+ }++ return props.image.url+ .split('https://media.sketchfab.com/models/')[1]+ .split('/')[0]+ })++ const fullLicenseName = computed(() => {+ return props.image+ ? getFullLicenseName(props.image.license, props.image.license_version)+ : ''+ })+ const licenseUrl = computed(+ () => `${props.image.license_url}?ref=openverse`+ )++ const goBackToSearchResults = () => router.back()+ const onImageLoad = (event) => emit('onImageLoaded', event)++ const tabClass = (tabIdx, tabClass) => {+ return {+ [tabClass]: true,+ 'is-active': tabIdx === activeTab.value,+ }+ }+ const setActiveTab = (tabIdx) => (activeTab.value = tabIdx)++ const onCloseReportForm = () => (isReportFormVisible.value = false)+ const toggleReportFormVisibility = () => {+ isReportFormVisible.value = !isReportFormVisible.value+ }++ const sendEvent = (eventType) => {+ const eventData = {+ eventType,+ resultUuid: props.image.id,+ }+ store.dispatch(`${USAGE_DATA}/${SEND_DETAIL_PAGE_EVENT}`, eventData)+ }+ const onPhotoSourceLinkClicked = () =>+ sendEvent(DETAIL_PAGE_EVENTS.SOURCE_CLICKED)+ const onPhotoCreatorLinkClicked = () =>+ sendEvent(DETAIL_PAGE_EVENTS.CREATOR_CLICKED)++ return {+ imgUrl,+ onImageLoad,+ isLoaded,+ sketchFabUid,+ sketchFabfailure,+ isReportFormVisible,+ goBackToSearchResults,+ linkClicked: {+ photoSource: onPhotoSourceLinkClicked,+ creatorLink: onPhotoCreatorLinkClicked,+ },+ license: {+ url: licenseUrl.value,+ fullName: fullLicenseName.value,+ },+ reportForm: {+ close: onCloseReportForm,+ toggleVisibility: toggleReportFormVisibility,+ },+ icons: {+ chevronLeft,+ externalLink,+ flag,+ },++ activeTab,+ tabClass,+ setActiveTab,++ providerName,+ }+ },+}+</script>++<style lang="scss" scoped>+.photo_image.loading {+ width: 100%;+}++.photo_image-ctr {+ overflow: hidden;+ text-align: center;++ img {+ position: relative;+ width: 100%;+ height: auto;+ max-height: 44rem;+ max-width: 100%;+ object-fit: contain;+ }+}++.tab:first-child {+ margin-inline-start: 0;+}+</style>diff --git a/src/components/MediaInfo/CopyLicense.vue b/src/components/MediaInfo/CopyLicense.vueindex c58278651..23260e45c 100644--- a/src/components/MediaInfo/CopyLicense.vue+++ b/src/components/MediaInfo/CopyLicense.vue@@ -179,9 +179,13 @@ import {} from '~/constants/usage-data-analytics-types'import { isPublicDomain } from '~/utils/license'import { ATTRIBUTION, USAGE_DATA } from '~/constants/store-modules'+import CopyButton from '~/components/CopyButton.vue'export default {name: 'CopyLicense',+ components: {+ CopyButton,+ },props: {media: {},fullLicenseName: String,diff --git a/src/components/MediaInfo/MediaLicense.vue b/src/components/MediaInfo/MediaLicense.vueindex 40c6e207d..f462cf709 100644--- a/src/components/MediaInfo/MediaLicense.vue+++ b/src/components/MediaInfo/MediaLicense.vue@@ -63,9 +63,13 @@<script>import { isLicense } from '~/utils/license'+import LicenseElements from '~/components/LicenseElements.vue'export default {name: 'MediaLicense',+ components: {+ LicenseElements,+ },props: {fullLicenseName: String,license: String,diff --git a/src/components/VContentReport/VContentReportForm.vue b/src/components/VContentReport/VContentReportForm.vuenew file mode 100644index 000000000..f3e5e69dc--- /dev/null+++ b/src/components/VContentReport/VContentReportForm.vue@@ -0,0 +1,181 @@+<template>+ <div id="content-report-form" class="p-4 arrow-popup">+ <button+ :aria-label="$t('photo-details.aria.close-form')"+ class="button close-button is-text tiny float-right block bg-white"+ type="button"+ @click="closeForm"+ >+ <VIcon :icon-path="closeIcon" />+ </button>+ <VDmcaNotice+ v-if="showDmcaForm"+ :image-url="image.foreign_landing_url"+ :provider="providerName"+ :dmca-form-url="dmcaFormUrl"+ @back-click="onBackClick"+ />+ <VDoneMessage+ v-else-if="isDone"+ :image-url="image.foreign_landing_url"+ :provider="providerName"+ />+ <VReportError v-else-if="reportFailed" @back-click="backToReportStart" />++ <VOtherIssueForm+ v-else-if="showOtherForm"+ @back-click="onBackClick"+ @send-report="sendContentReport"+ />+ <form v-else>+ <h5 class="b-header mb-4">+ {{ $t('photo-details.content-report.title') }}+ </h5>+ <fieldset class="mb-4 flex flex-col">+ <legend class="mb-4">+ {{ $t('photo-details.content-report.issue') }}+ </legend>+ <label+ v-for="reason in reasons"+ :key="reason"+ :for="reason"+ class="ms-2 mb-2"+ >+ <input+ :id="reason"+ v-model="reasonSelected"+ type="radio"+ name="type"+ :value="reason"+ />+ {{ $t(`photo-details.content-report.reasons.${reason}`) }}+ </label>+ </fieldset>++ <p class="caption font-semibold text-gray mb-4">+ {{ $t('photo-details.content-report.caption') }}+ </p>++ <VButton+ :disabled="!reasonSelected"+ variant="secondary"+ class="float-end bg-trans-blue"+ @click="onIssueSelected"+ >+ {{ $t('photo-details.content-report.next') }}+ </VButton>+ </form>+ </div>+</template>++<script>+import { computed, defineComponent, ref } from '@nuxtjs/composition-api'+import VDmcaNotice from './VDmcaNotice'+import VOtherIssueForm from './VOtherIssueForm'+import VDoneMessage from './VDoneMessage'+import VReportError from './VReportError'+import ReportService from '~/data/report-service'++import closeIcon from '~/assets/icons/close.svg'+import VIcon from '~/components/VIcon/VIcon.vue'+import VButton from '~/components/VButton.vue'++const dmcaFormUrl =+ 'https://docs.google.com/forms/d/e/1FAIpQLSd0I8GsEbGQLdaX4K_F6V2NbHZqN137WMZgnptUpzwd-kbDKA/viewform'+const reasons = {+ DMCA: 'dmca',+ MATURE: 'mature',+ OTHER: 'other',+}+const statuses = {+ SENT: 'sent',+ FAILED: 'failed',+ ADDING_DETAILS: 'adding_details',+ OPEN: 'open',+ CLOSED: 'closed',+}++export default defineComponent({+ name: 'VContentReportForm',+ components: {+ VDoneMessage,+ VDmcaNotice,+ VReportError,+ VOtherIssueForm,+ VButton,+ VIcon,+ },+ props: ['image', 'providerName', 'reportService'],+ setup(props, { emit }) {+ const reportStatus = ref(statuses.OPEN)+ /** @type {import('@nuxtjs/composition-api').Ref<string|null>} */+ const reasonSelected = ref(null)++ const service = props.reportService || ReportService+ const onIssueSelected = () => {+ if (+ reasonSelected.value &&+ ![reasons.OTHER, reasons.DMCA].includes(reasonSelected.value)+ ) {+ sendContentReport()+ } else {+ reportStatus.value = statuses.ADDING_DETAILS+ }+ }+ const onBackClick = () => {+ reportStatus.value = statuses.OPEN+ }+ const backToReportStart = () => {+ reasonSelected.value = null+ reportStatus.value = statuses.OPEN+ }+ const sendContentReport = async ({ description = '' } = {}) => {+ try {+ await service.sendReport({+ identifier: props.image.id,+ reason: reasonSelected.value,+ description,+ })+ reportStatus.value = statuses.SENT+ } catch (error) {+ reportStatus.value = statuses.FAILED+ }+ }+ const closeForm = () => {+ reportStatus.value = statuses.CLOSED+ emit('close-form')+ }+ const reportFailed = computed(() => reportStatus.value === statuses.FAILED)+ const isDone = computed(+ () =>+ reportStatus.value === statuses.SENT &&+ !(reasonSelected.value === reasons.DMCA)+ )+ const showOtherForm = computed(+ () =>+ reportStatus.value === statuses.ADDING_DETAILS &&+ reasonSelected.value === reasons.OTHER+ )+ const showDmcaForm = computed(+ () =>+ reportStatus.value === statuses.ADDING_DETAILS &&+ reasonSelected.value === reasons.DMCA+ )+ return {+ reasonSelected,+ closeIcon,+ dmcaFormUrl,+ isDone,+ reportFailed,+ closeForm,+ onIssueSelected,+ onBackClick,+ sendContentReport,+ backToReportStart,+ showOtherForm,+ showDmcaForm,+ reasons: Object.values(reasons),+ }+ },+})+</script>diff --git a/src/components/VContentReport/VDmcaNotice.vue b/src/components/VContentReport/VDmcaNotice.vuenew file mode 100644index 000000000..0d80eea48--- /dev/null+++ b/src/components/VContentReport/VDmcaNotice.vue@@ -0,0 +1,79 @@+<template>+ <div>+ <i18n+ path="photo-details.content-report.dmca.content"+ tag="p"+ class="block px-6 mt-10 text-center"+ >+ <template #link>+ <a+ :aria-label="$t('photo-details.aria.dmca')"+ :href="dmcaFormUrl"+ target="_blank"+ rel="noopener"+ >{{ $t('photo-details.content-report.dmca.link') }}</a+ >+ </template>+ </i18n>++ <i18n+ path="photo-details.content-report.provider"+ tag="p"+ class="block px-6 mt-4 text-center"+ >+ <template #link>+ <a+ :aria-label="+ $t('photo-details.aria.provider-report-form', { provider })+ "+ :href="imageUrl"+ target="_blank"+ rel="noopener"+ >{{ provider }}</a+ >+ </template>+ </i18n>++ <VButton+ type="button"+ variant="action-button"+ size="small"+ @click="onBackClick"+ >+ <VIcon :icon-path="chevronLeftIcon" class="me-2" />+ {{ $t('photo-details.content-report.back') }}+ </VButton>+ </div>+</template>++<script>+import { defineComponent } from '@nuxtjs/composition-api'+import VButton from '~/components/VButton.vue'+import VIcon from '~/components/VIcon/VIcon.vue'+import chevronLeftIcon from '~/assets/icons/chevron-left.svg'++export default defineComponent({+ name: 'DmcaNotice',+ components: { VButton, VIcon },+ props: {+ dmcaFormUrl: {+ type: String,+ required: true,+ },+ imageUrl: {+ type: String,+ required: true,+ },+ provider: {+ type: String,+ required: true,+ },+ },+ setup(_, { emit }) {+ const onBackClick = () => {+ emit('back-click')+ }+ return { chevronLeftIcon, onBackClick }+ },+})+</script>diff --git a/src/components/ContentReport/DoneMessage.vue b/src/components/VContentReport/VDoneMessage.vuesimilarity index 55%rename from src/components/ContentReport/DoneMessage.vuerename to src/components/VContentReport/VDoneMessage.vueindex 0605fda67..3d5da618f 100644--- a/src/components/ContentReport/DoneMessage.vue+++ b/src/components/VContentReport/VDoneMessage.vue@@ -1,24 +1,22 @@<template><div class="my-10"><span class="block px-6 text-center">- {{ $t('photo-details.content-report.dmca.thanks') }}+ {{ $t('photo-details.content-report.thanks') }}</span><i18n- path="photo-details.content-report.dmca.provider"+ path="photo-details.content-report.provider"tag="span"class="block px-6 mt-10 text-center"><template #link><a:aria-label="- $t('photo-details.aria.provider-report-form', {- provider: providerName,- })+ $t('photo-details.aria.provider-report-form', { provider })"- :href="imageURL"+ :href="imageUrl"target="_blank"rel="noopener"- >{{ providerName }}</a+ >{{ provider }}</a></template></i18n>@@ -28,6 +26,6 @@<script>export default {name: 'DoneMessage',- props: ['imageURL', 'providerName'],+ props: ['imageUrl', 'provider'],}</script>diff --git a/src/components/VContentReport/VOtherIssueForm.vue b/src/components/VContentReport/VOtherIssueForm.vuenew file mode 100644index 000000000..c9706f987--- /dev/null+++ b/src/components/VContentReport/VOtherIssueForm.vue@@ -0,0 +1,72 @@+<template>+ <form class="other-form">+ <h4 class="b-header">+ {{ $t('photo-details.content-report.title') }}+ </h4>+ <label for="description" class="mb-2">+ {{ $t('photo-details.content-report.issue-description') }}+ <textarea+ id="description"+ v-model="description"+ class="reason p-2 font-semibold border border-dark-charcoal w-full h-24 text-sm"+ :placeholder="$t('photo-details.content-report.placeholder')"+ />+ </label>++ <div class="flex flex-row justify-between align-end mt-4">+ <VButton+ type="button"+ variant="action-button"+ size="small"+ @click="onBackClick"+ >+ <VIcon :icon-path="chevronLeftIcon" class="me-2" />+ {{ $t('photo-details.content-report.back') }}+ </VButton>++ <VButton+ :disabled="!isValid"+ variant="secondary"+ class="float-right bg-trans-blue"+ @click="sendContentReport"+ >+ {{ $t('photo-details.content-report.submit') }}+ </VButton>+ </div>+ </form>+</template>++<script>+import { computed, defineComponent, ref } from '@nuxtjs/composition-api'+import chevronLeftIcon from '~/assets/icons/chevron-left.svg'+import VButton from '~/components/VButton.vue'+import VIcon from '~/components/VIcon/VIcon.vue'++export default defineComponent({+ name: 'OtherIssueForm',+ components: {+ VButton,+ VIcon,+ },+ setup(_, { emit }) {+ const onBackClick = () => {+ emit('back-click')+ }+ const description = ref('')+ const descriptionHasMoreThan20Chars = computed(+ () => description.value.length >= 20+ )++ const sendContentReport = () =>+ emit('send-report', { description: description.value })+ return {+ chevronLeftIcon,+ description,+ isValid: descriptionHasMoreThan20Chars,++ onBackClick,+ sendContentReport,+ }+ },+})+</script>diff --git a/src/components/VContentReport/VReportError.vue b/src/components/VContentReport/VReportError.vuenew file mode 100644index 000000000..2ae32ad41--- /dev/null+++ b/src/components/VContentReport/VReportError.vue@@ -0,0 +1,26 @@+<template>+ <div>+ <span class="block px-6 mt-10 text-center">+ {{ $t('photo-details.content-report.submission-error') }}+ </span>+ <button class="button is-text tiny mt-4" type="button" @click="onBackClick">+ <VIcon :icon-path="chevronLeftIcon" class="me-2" />+ {{ $t('photo-details.content-report.back') }}+ </button>+ </div>+</template>++<script>+import { defineComponent } from '@nuxtjs/composition-api'+import VIcon from '~/components/VIcon/VIcon.vue'+import chevronLeftIcon from '~/assets/icons/chevron-left.svg'++export default defineComponent({+ name: 'VReportError',+ components: { VIcon },+ setup(_, { emit }) {+ const onBackClick = () => emit('back-click')+ return { chevronLeftIcon, onBackClick }+ },+})+</script>diff --git a/src/constants/action-types.js b/src/constants/action-types.jsindex 8de822bb7..c571a739e 100644--- a/src/constants/action-types.js+++ b/src/constants/action-types.js@@ -8,7 +8,6 @@ export const REPORT_BUG = 'REPORT_BUG'export const CONVERT_AB_TEST_EXPERIMENT = 'CONVERT_AB_TEST_EXPERIMENT'export const HANDLE_MEDIA_ERROR = 'HANDLE_MEDIA_ERROR'export const TOGGLE_FILTER = 'TOGGLE_FILTER'-export const SEND_CONTENT_REPORT = 'SEND_CONTENT_REPORT'export const UPDATE_SEARCH_TYPE = 'UPDATE_SEARCH_TYPE'export const HANDLE_NO_MEDIA = 'HANDLE_NO_MEDIA'export const NOTIFICATION_ACTION = 'NOTIFICATION_ACTION'diff --git a/src/constants/mutation-types.js b/src/constants/mutation-types.jsindex 1555cd2bb..332e0637f 100644--- a/src/constants/mutation-types.js+++ b/src/constants/mutation-types.js@@ -16,11 +16,6 @@ export const REPORT_BUG_START = 'REPORT_BUG_START'export const REPORT_BUG_END = 'REPORT_BUG_END'export const REPORT_BUG_FAILED = 'REPORT_BUG_FAILED'export const JOINED_AB_TEST_EXPERIMENT = 'JOINED_AB_TEST_EXPERIMENT'-export const TOGGLE_REPORT_FORM_VISIBILITY = 'TOGGLE_REPORT_FORM_VISIBILITY'-export const REPORT_SENT = 'REPORT_SENT'-export const REPORT_ERROR = 'REPORT_ERROR'-export const BACK_TO_REPORT_START = 'BACK_TO_REPORT_START'-export const REPORT_FORM_CLOSED = 'REPORT_FORM_CLOSED'export const SET_SHOW_NOTIFICATION = 'SET_SHOW_NOTIFICATION'export const SET_EMBEDDED = 'SET_EMBEDDED'export const SET_REFERRED = 'SET_REFERRED'diff --git a/src/constants/store-modules.js b/src/constants/store-modules.jsindex 593f6e6ba..e10c5f09f 100644--- a/src/constants/store-modules.js+++ b/src/constants/store-modules.js@@ -5,7 +5,6 @@ export const ATTRIBUTION = 'attribution'export const PROVIDER = 'provider'export const NAV = 'nav'export const NOTIFICATION = 'notification'-export const REPORT_CONTENT = 'report-content'export const USAGE_DATA = 'usage-data'export const SEARCH = 'search'export const MEDIA = 'media'diff --git a/src/locales/en.json b/src/locales/en.jsonindex 34c05c45e..2fa0012bf 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -535,21 +535,24 @@"title": "Report this content","issue": "What's the issue?","issue-description": "Please describe the issue for us",- "copyright": "Infringes Copyright",- "mature": "Contains mature content",- "other": "Other",+ "reasons": {+ "dmca": "Infringes Copyright",+ "mature": "Contains mature content",+ "other": "Other"+ },+ "dmca": {+ "link": "DMCA form",+ "content": "You must fill out this {link} to report copyright infringement. No action will be taken until the form is filled out and submitted."+ },"caption": "For security purposes, Openverse collects and retains anonymized IP addresses of those who complete and submit this form.","next": "Next","back": "Back","submit": "Submit",- "dmca": {- "content": "You must fill out this {link} to report copyright infringement. No action will be taken until the form is filled out and submitted.",- "provider": "We recommend doing the same at the source, {link}.",- "thanks": "Thank you for reporting an issue with the results of Openverse!",- "submission-error": "There was an error with the report submission. Please try again.",- "link": "DMCA form",- "aria-form": "{provider} form"- }+ "thanks": "Thank you for reporting an issue with the results of Openverse!",+ "provider": "We recommend doing the same at the source, {link}.",+ "aria-form": "{provider} form",+ "submission-error": "There was an error with the report submission. Please try again.",+ "placeholder": "Issue description required (with at least 20 characters)"},"aria": {"close-form": "close form",diff --git a/src/locales/po-files/openverse.pot b/src/locales/po-files/openverse.potindex c6a2a69dc..ae097f7b3 100644--- a/src/locales/po-files/openverse.pot+++ b/src/locales/po-files/openverse.pot@@ -4,7 +4,7 @@ msgid ""msgstr """Project-Id-Version: Openverse \n""Report-Msgid-Bugs-To: https://github.com/wordpress/openverse/issues \n"-"POT-Creation-Date: 2021-12-16T09:49:12+00:00\n"+"POT-Creation-Date: 2022-01-06T04:23:46+00:00\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"@@ -188,13 +188,13 @@ msgctxt "audio-thumbnail.alt"msgid "Cover art for \"###title###\" by ###creator###"msgstr ""-#: src/components/VAudioTrack/Waveform.vue:12+#: src/components/VAudioTrack/VWaveform.vue:12msgctxt "waveform.label"msgid "Audio seek bar"msgstr ""#. Do not translate words between ### ###.-#: src/components/VAudioTrack/Waveform.vue:513+#: src/components/VAudioTrack/VWaveform.vue:514msgctxt "waveform.current-time"msgid "###time### seconds"msgstr ""@@ -215,7 +215,7 @@ msgctxt "browsers.edge"msgid "Edge"msgstr ""-#: src/components/VMetaSearch/VMetaSearchForm.vue:43+#: src/components/VMetaSearch/VMetaSearchForm.vue:39msgctxt "meta-search.caption"msgid "Openverse does not currently index the sources listed above, but through this interface is offering convenient access to search services provided by other independent organizations. Openverse has no control over the results that are returned. Do not assume that the results displayed in this search portal are under a CC license. Always verify that the work is actually under a CC license by following the link. If you are in doubt, you should contact the copyright holder directly, or try to contact the site where you found the content."msgstr ""@@ -238,7 +238,7 @@ msgid "No ###type### results for \"###query###\"."msgstr ""#. Do not translate words between ### ###.-#: src/components/VMetaSearch/VMetaSearchForm.vue:31+#: src/components/VMetaSearch/VMetaSearchForm.vue:27msgctxt "meta-search.form.caption"msgid "Click on a source below to directly search other collections of CC-licensed ###type###.###break###Please note that Use filters are not supported for ###filter###."msgstr ""@@ -308,23 +308,23 @@ msgctxt "audio-details.table.genre"msgid "Genre"msgstr ""-#: src/components/ImageDetails/PhotoDetails.vue:12+#: src/components/ImageDetails/VPhotoDetails.vue:11msgctxt "photo-details.back"msgid "Back to search results"msgstr ""#. Do not translate words between ### ###.-#: src/components/ImageDetails/PhotoDetails.vue:63+#: src/components/ImageDetails/VPhotoDetails.vue:59msgctxt "photo-details.creator"msgid "by ###name###"msgstr ""-#: src/components/ImageDetails/PhotoDetails.vue:153+#: src/components/ImageDetails/VPhotoDetails.vue:146msgctxt "photo-details.weblink"msgid "Go to image's website"msgstr ""-#: src/components/ImageDetails/PhotoDetails.vue:31+#: src/components/ImageDetails/VPhotoDetails.vue:29msgctxt "photo-details.legal-disclaimer"msgid "Openverse aggregates data from publicly available repositories of open content. Openverse does not host the content and does not verify that the content is properly CC-licensed or that the attribution information is accurate or complete. Please follow the link to the source of the content to independently verify before reuse."msgstr ""@@ -334,17 +334,17 @@ msgctxt "photo-details.related-images"msgid "Related Images"msgstr ""-#: src/components/ContentReport/ContentReportForm.vue:4+#: src/components/VContentReport/VContentReportForm.vue:4msgctxt "photo-details.aria.close-form"msgid "close form"msgstr ""-#: src/components/ContentReport/DmcaNotice.vue:10+#: src/components/VContentReport/VDmcaNotice.vue:10msgctxt "photo-details.aria.dmca"msgid "dmca form"msgstr ""-#: src/components/ImageDetails/PhotoDetails.vue:56+#: src/components/ImageDetails/VPhotoDetails.vue:52msgctxt "photo-details.aria.details"msgid "image details"msgstr ""@@ -360,13 +360,13 @@ msgid "related images"msgstr ""#. Do not translate words between ### ###.-#: src/components/ContentReport/DmcaNotice.vue:27+#: src/components/VContentReport/VDmcaNotice.vue:27msgctxt "photo-details.aria.provider-report-form"msgid "###provider### form"msgstr ""#. Do not translate words between ### ###.-#: src/components/ImageDetails/PhotoDetails.vue:73+#: src/components/ImageDetails/VPhotoDetails.vue:69msgctxt "photo-details.aria.creator-url"msgid "author ###creator###"msgstr ""@@ -379,86 +379,88 @@ msgctxt "photo-details.aria.attribution.tool"msgid "read more about the tool"msgstr ""-#: src/components/ContentReport/ContentReportForm.vue:32+#: src/components/ImageDetails/VPhotoDetails.vue:38msgctxt "photo-details.content-report.title"msgid "Report this content"msgstr ""-#: src/components/ContentReport/ContentReportForm.vue:36+#: src/components/VContentReport/VContentReportForm.vue:36msgctxt "photo-details.content-report.issue"msgid "What's the issue?"msgstr ""-#: src/components/ContentReport/OtherIssueForm.vue:7+#: src/components/VContentReport/VOtherIssueForm.vue:7msgctxt "photo-details.content-report.issue-description"msgid "Please describe the issue for us"msgstr ""-#: src/components/ContentReport/ContentReportForm.vue:48-msgctxt "photo-details.content-report.copyright"-msgid "Infringes Copyright"-msgstr ""--#: src/components/ContentReport/ContentReportForm.vue:61-msgctxt "photo-details.content-report.mature"-msgid "Contains mature content"-msgstr ""--#: src/components/ContentReport/ContentReportForm.vue:74-msgctxt "photo-details.content-report.other"-msgid "Other"-msgstr ""--#: src/components/ContentReport/ContentReportForm.vue:80+#: src/components/VContentReport/VContentReportForm.vue:56msgctxt "photo-details.content-report.caption"msgid "For security purposes, Openverse collects and retains anonymized IP addresses of those who complete and submit this form."msgstr ""-#: src/components/ContentReport/ContentReportForm.vue:90+#: src/components/VContentReport/VContentReportForm.vue:65msgctxt "photo-details.content-report.next"msgid "Next"msgstr ""-#: src/components/ContentReport/DmcaNotice.vue:46+#: src/components/VContentReport/VDmcaNotice.vue:44msgctxt "photo-details.content-report.back"msgid "Back"msgstr ""-#: src/components/ContentReport/OtherIssueForm.vue:36+#: src/components/VContentReport/VOtherIssueForm.vue:33msgctxt "photo-details.content-report.submit"msgid "Submit"msgstr ""-#. Do not translate words between ### ###.-#: src/components/ContentReport/DmcaNotice.vue:3-msgctxt "photo-details.content-report.dmca.content"-msgid "You must fill out this ###link### to report copyright infringement. No action will be taken until the form is filled out and submitted."+#: src/components/VContentReport/VDoneMessage.vue:4+msgctxt "photo-details.content-report.thanks"+msgid "Thank you for reporting an issue with the results of Openverse!"msgstr ""#. Do not translate words between ### ###.-#: src/components/ContentReport/DmcaNotice.vue:19-msgctxt "photo-details.content-report.dmca.provider"+#: src/components/VContentReport/VDmcaNotice.vue:19+msgctxt "photo-details.content-report.provider"msgid "We recommend doing the same at the source, ###link###."msgstr ""-#: src/components/ContentReport/DoneMessage.vue:4-msgctxt "photo-details.content-report.dmca.thanks"-msgid "Thank you for reporting an issue with the results of Openverse!"+#. Do not translate words between ### ###.+msgctxt "photo-details.content-report.aria-form"+msgid "###provider### form"msgstr ""-#: src/components/ContentReport/ReportError.vue:4-msgctxt "photo-details.content-report.dmca.submission-error"+#: src/components/VContentReport/VReportError.vue:4+msgctxt "photo-details.content-report.submission-error"msgid "There was an error with the report submission. Please try again."msgstr ""-#: src/components/ContentReport/DmcaNotice.vue:14+#: src/components/VContentReport/VOtherIssueForm.vue:12+msgctxt "photo-details.content-report.placeholder"+msgid "Issue description required (with at least 20 characters)"+msgstr ""++#: src/components/VContentReport/VDmcaNotice.vue:14msgctxt "photo-details.content-report.dmca.link"msgid "DMCA form"msgstr ""#. Do not translate words between ### ###.-msgctxt "photo-details.content-report.dmca.aria-form"-msgid "###provider### form"+#: src/components/VContentReport/VDmcaNotice.vue:3+msgctxt "photo-details.content-report.dmca.content"+msgid "You must fill out this ###link### to report copyright infringement. No action will be taken until the form is filled out and submitted."+msgstr ""++msgctxt "photo-details.content-report.reasons.dmca"+msgid "Infringes Copyright"+msgstr ""++msgctxt "photo-details.content-report.reasons.mature"+msgid "Contains mature content"+msgstr ""++msgctxt "photo-details.content-report.reasons.other"+msgid "Other"msgstr ""#: src/components/CopyButton.vue:9@@ -486,7 +488,7 @@ msgctxt "photo-details.survey.answer"msgid "by answering a few questions."msgstr ""-#: src/components/ImageDetails/PhotoDetails.vue:107+#: src/components/ImageDetails/VPhotoDetails.vue:102msgctxt "photo-details.information.title"msgid "Information"msgstr ""@@ -525,7 +527,7 @@ msgctxt "photo-details.information.pixels"msgid "pixels"msgstr ""-#: src/components/ImageDetails/PhotoDetails.vue:96+#: src/components/ImageDetails/VPhotoDetails.vue:91msgctxt "photo-details.reuse.title"msgid "Reuse"msgstr ""@@ -564,7 +566,7 @@ msgctxt "media-details.reuse.audio"msgid "Audio"msgstr ""-#: src/components/MediaInfo/CopyLicense.vue:209+#: src/components/MediaInfo/CopyLicense.vue:213msgctxt "media-details.reuse.image"msgid "Image"msgstr ""@@ -727,7 +729,6 @@ msgctxt "browse-page.fetching-error"msgid "Error fetching ###type###:"msgstr ""-#: src/components/AppModal.vue:13msgctxt "browse-page.aria.close"msgid "close"msgstr ""@@ -1140,7 +1141,7 @@ msgid "An error occurred"msgstr ""#. Do not translate words between ### ###.-#: src/pages/image/_id.vue:54+#: src/pages/image/_id.vue:57msgctxt "error.image-not-found"msgid "Couldn't find image with id ###id###"msgstr ""diff --git a/src/pages/image/_id.vue b/src/pages/image/_id.vueindex c7d23ad66..8b9957675 100644--- a/src/pages/image/_id.vue+++ b/src/pages/image/_id.vue@@ -1,6 +1,6 @@<template><div :aria-label="$t('photo-details.aria.main')">- <PhotoDetails+ <VPhotoDetails:image="image":thumbnail="thumbnailURL":bread-crumb-u-r-l="breadCrumbURL"@@ -19,9 +19,12 @@ import axios from 'axios'import { mapActions, mapState } from 'vuex'import { FETCH_IMAGE } from '~/constants/action-types'import { MEDIA } from '~/constants/store-modules'+import RelatedImages from '~/components/ImageDetails/RelatedImages.vue'+import VPhotoDetails from '~/components/ImageDetails/VPhotoDetails.vue'const PhotoDetailPage = {name: 'PhotoDetailPage',+ components: { RelatedImages, VPhotoDetails },layout: 'with-nav-search',data() {return {diff --git a/src/store/bug-report.js b/src/store/bug-report.jsindex 4b85d6077..ffd68e339 100644--- a/src/store/bug-report.js+++ b/src/store/bug-report.js@@ -25,7 +25,6 @@ export const state = () => ({bugReportFailed: false,})-/* eslint no-param-reassign: ["error", { "props": false }] */export const mutations = {[REPORT_BUG_START](_state) {_state.isReportingBug = truediff --git a/src/store/provider.js b/src/store/provider.jsindex 71d9dad6b..1e6a8c6b8 100644--- a/src/store/provider.js+++ b/src/store/provider.js@@ -12,6 +12,7 @@ import {SET_MEDIA_PROVIDERS,SET_PROVIDERS_FILTERS,} from '~/constants/mutation-types'+import { capital } from 'case'import { SEARCH } from '~/constants/store-modules'const AudioProviderService = MediaProviderService(AUDIO)@@ -34,6 +35,22 @@ export const state = () => ({isFetchingImageProviders: false,})+export const getters = {+ getProviderName: (state, getters, rootState) => (providerCode) => {+ const mediaType = rootState.search.mediaType+ const providersList = state[`${mediaType}Providers`]+ if (!providersList) {+ return capital(providerCode) || ''+ }++ const provider = providersList.filter(+ (p) => p.source_name === providerCode+ )[0]++ return provider ? provider.display_name : capital(providerCode) || ''+ },+}+export const createActions = (services) => ({async [FETCH_MEDIA_PROVIDERS]({ dispatch }, params) {return Promise.all([@@ -81,7 +98,6 @@ export const actions = createActions({[AUDIO]: AudioProviderService,})-/* eslint no-param-reassign: ["error", { "props": false }] */export const mutations = {[FETCH_MEDIA_PROVIDERS_START](_state, { mediaType }) {if (mediaType === AUDIO) {@@ -110,6 +126,7 @@ export const mutations = {}export default {+ getters,state,mutations,actions,diff --git a/src/store/report-content.js b/src/store/report-content.jsindex ad1ff0ee6..e69de29bb 100644--- a/src/store/report-content.js+++ b/src/store/report-content.js@@ -1,53 +0,0 @@-import {- TOGGLE_REPORT_FORM_VISIBILITY,- REPORT_SENT,- REPORT_FORM_CLOSED,- REPORT_ERROR,- BACK_TO_REPORT_START,-} from '~/constants/mutation-types'-import { SEND_CONTENT_REPORT } from '~/constants/action-types'-import ReportService from '~/data/report-service'--export const state = () => ({- isReportFormVisible: false,- isReportSent: false,- reportFailed: false,-})--/* eslint no-param-reassign: ["error", { "props": false }] */-export const mutations = {- [TOGGLE_REPORT_FORM_VISIBILITY](_state) {- _state.isReportFormVisible = !_state.isReportFormVisible- },- [REPORT_SENT](_state) {- _state.isReportSent = true- },- [REPORT_ERROR](_state) {- _state.reportFailed = true- },- [BACK_TO_REPORT_START](_state) {- _state.reportFailed = false- _state.isReportSent = false- },- [REPORT_FORM_CLOSED](_state) {- _state.isReportSent = false- _state.reportFailed = false- _state.isReportFormVisible = false- },-}-export const createActions = (reportService) => ({- [SEND_CONTENT_REPORT]({ commit }, params) {- return reportService- .sendReport(params)- .then(() => commit(REPORT_SENT))- .catch(() => commit(REPORT_ERROR))- },-})--export const actions = createActions(ReportService)--export default {- state,- mutations,- actions,-}diff --git a/test/unit/specs/components/ContentReport/content-report-form.spec.js b/test/unit/specs/components/ContentReport/content-report-form.spec.jsindex adad5b2bf..03f5f7b73 100644--- a/test/unit/specs/components/ContentReport/content-report-form.spec.js+++ b/test/unit/specs/components/ContentReport/content-report-form.spec.js@@ -1,146 +1,173 @@-import ContentReportForm from '~/components/ContentReport/ContentReportForm'-import render from '../../../test-utils/render'-import i18n from '../../../test-utils/i18n'-import { REPORT_CONTENT } from '~/constants/store-modules'-import { SEND_CONTENT_REPORT } from '~/constants/action-types'-import { REPORT_FORM_CLOSED } from '~/constants/mutation-types'-import Vuex from 'vuex'+import { fireEvent, render, screen } from '@testing-library/vue'import { createLocalVue } from '@vue/test-utils'-import reportContentStore from '~/store/report-content'+import VueI18n from 'vue-i18n'+import VContentReportForm from '~/components/VContentReport/VContentReportForm.vue'++const messages = require('~/locales/en.json')+const i18n = new VueI18n({+ locale: 'en',+ fallbackLocale: 'en',+ messages,+})++const getCloseButton = () =>+ screen.getByRole('button', {+ name: /close-form/i,+ })+const getNextButton = () =>+ screen.getByRole('button', {+ name: /next/i,+ })+const getDmcaInput = () =>+ screen.getByRole('radio', {+ name: /dmca/i,+ })+const getMatureInput = () =>+ screen.getByRole('radio', {+ name: /mature/i,+ })+const getOtherInput = () =>+ screen.getByRole('radio', {+ name: /other/i,+ })-describe('ContentReportForm', () => {+describe('VContentReportForm', () => {let props = nulllet options = {}- let dispatchMock = null- let commitMock = null- const $t = (key) => i18n.messages[key]- let storeMock = null- let localVue = null++ let reportServiceProp = { sendReport: () => Promise.resolve() }beforeEach(() => {props = {image: { id: 1, url: 'http://foo.bar' },+ providerName: 'provider',+ reportService: reportServiceProp,}- dispatchMock = jest.fn()- commitMock = jest.fn()- localVue = createLocalVue()- localVue.use(Vuex)- storeMock = new Vuex.Store({- modules: {- 'report-content': {- namespaced: true,- state: {- isReportSent: false,- reportFailed: false,- },- mutations: {- ...reportContentStore.mutations,- [REPORT_FORM_CLOSED]: commitMock,- },- actions: reportContentStore.actions,- },- provider: {- namespaced: true,- imageProviders: [],- },- },- })+ const localVue = createLocalVue()+ localVue.use(VueI18n)options = {propsData: props,- store: storeMock,- localVue,- mocks: {- $t,- },+ i18n,}})it('should contain the correct contents', async () => {- const wrapper = render(ContentReportForm, options)- expect(wrapper.find('.arrow-popup').element).toBeDefined()+ await render(VContentReportForm, options)+ getCloseButton()+ getDmcaInput()+ getMatureInput()+ getOtherInput()+ getNextButton()})- it('should render report sent', async () => {- storeMock.state[REPORT_CONTENT].isReportSent = true- const wrapper = render(ContentReportForm, options)- expect(wrapper.findComponent({ name: 'DoneMessage' }).vm).toBeDefined()+ it('should render thank you note when report is sent', async () => {+ const { getByText } = render(VContentReportForm, options)+ await fireEvent.click(getMatureInput())+ await fireEvent.click(getNextButton())++ // Thank you message with a link to provider+ getByText('photo-details.content-report.thanks')+ getByText('photo-details.content-report.provider')})- it('should render error message', async () => {- storeMock.state[REPORT_CONTENT].reportFailed = true- const wrapper = render(ContentReportForm, options)- expect(wrapper.findComponent({ name: 'ReportError' }).vm).toBeDefined()+ it('should render error message if report sending fails', async () => {+ options.propsData.reportService = { sendReport: () => Promise.reject() }++ const { getByText } = render(VContentReportForm, options)+ await fireEvent.click(getMatureInput())+ await fireEvent.click(getNextButton())++ // Submission error message+ getByText('photo-details.content-report.submission-error')+ getByText('photo-details.content-report.back')})it('should render dmca notice', async () => {- const wrapper = render(ContentReportForm, options)- await wrapper.setData({ selectedCopyright: true })- expect(wrapper.findComponent({ name: 'DmcaNotice' }).vm).toBeDefined()- })+ const { getByText } = render(VContentReportForm, options)+ await fireEvent.click(getDmcaInput())+ await fireEvent.click(getNextButton())- it('should render other type form', async () => {- const wrapper = render(ContentReportForm, options)- await wrapper.setData({ selectedOther: true })- expect(wrapper.findComponent({ name: 'OtherIssueForm' }).vm).toBeDefined()+ // Notice with link to provider+ getByText(/dmca/i)+ getByText('photo-details.content-report.provider')})- it('should navigate to other form', async () => {- const wrapper = render(ContentReportForm, options)- const radio = wrapper.find('#other')- await radio.setChecked()-- const button = wrapper.find('.next-button')- await button.trigger('click')- expect(wrapper.findComponent({ name: 'OtherIssueForm' }).vm).toBeDefined()+ it('should render other type form', async () => {+ const { getByRole, getByText } = render(VContentReportForm, options)+ await fireEvent.click(getOtherInput())+ await fireEvent.click(getNextButton())++ // Report form with a submit button+ getByText('photo-details.content-report.issue-description')+ getByRole('textbox', {+ name: /description/i,+ })+ getByRole('button', { name: 'photo-details.content-report.submit' })})it('should dispatch SEND_CONTENT_REPORT on next when mature is selected', async () => {- storeMock.dispatch = dispatchMock- const wrapper = render(ContentReportForm, options)- const radio = wrapper.find('#mature')- await radio.setChecked()-- const button = wrapper.find('.next-button')- await button.trigger('click')- expect(dispatchMock).toHaveBeenCalledWith(- `${REPORT_CONTENT}/${SEND_CONTENT_REPORT}`,- {- identifier: props.image.id,- reason: 'mature',- description: '',- }- )+ const serviceMock = { sendReport: jest.fn() }+ options.propsData.reportService = serviceMock+ render(VContentReportForm, options)+ await fireEvent.click(getMatureInput())+ await fireEvent.click(getNextButton())++ expect(serviceMock.sendReport).toHaveBeenCalledWith({+ identifier: props.image.id,+ reason: 'mature',+ description: '',+ })})it('should not dispatch SEND_CONTENT_REPORT on next when dmca is selected', async () => {- storeMock.dispatch = dispatchMock- const wrapper = render(ContentReportForm, options)- const radio = wrapper.find('#dmca')- await radio.setChecked()-- const button = wrapper.find('.next-button')- await button.trigger('click')- expect(dispatchMock).not.toHaveBeenCalled()+ const serviceMock = { sendReport: jest.fn() }+ options.propsData.reportService = serviceMock++ render(VContentReportForm, options)+ await fireEvent.click(getDmcaInput())+ await fireEvent.click(getNextButton())++ expect(serviceMock.sendReport).toBeCalledTimes(0)})it('should dispatch SEND_CONTENT_REPORT on other form submit', async () => {- storeMock.dispatch = dispatchMock- const wrapper = render(ContentReportForm, options)- await wrapper.setData({ selectedReason: 'other' })- const description = 'foo bar'- wrapper.vm.sendContentReport(description)- expect(dispatchMock).toHaveBeenCalledWith(- `${REPORT_CONTENT}/${SEND_CONTENT_REPORT}`,- {- identifier: props.image.id,- reason: 'other',- description,- }- )+ const serviceMock = { sendReport: jest.fn() }+ options.propsData.reportService = serviceMock++ const { getByRole } = render(VContentReportForm, options)+ await fireEvent.click(getOtherInput())+ await fireEvent.click(getNextButton())++ const description = 'description that has more than 20 characters'+ await fireEvent.update(getByRole('textbox'), description)+ await fireEvent.click(getByRole('button', { name: /submit/i }))+ expect(serviceMock.sendReport).toHaveBeenCalledWith({+ identifier: props.image.id,+ reason: 'other',+ description,+ })})- // TODO: Rewrite test using testing library (@obulat)- it('should close form', async () => {})+ it('should not send other report if description is short', async () => {+ options.propsData.reportService = { sendReport: jest.fn() }++ const { getByRole } = render(VContentReportForm, options)+ await fireEvent.click(getOtherInput())+ await fireEvent.click(getNextButton())++ const description = 'short'+ await fireEvent.update(getByRole('textbox'), description)++ expect(getByRole('button', { name: /submit/i })).toBeDisabled()++ // Even though the button is disabled, if we `fireEvent.click`, the report+ // in this test is sent+ // expect(serviceMock.sendReport).toHaveBeenCalledWith({+ // identifier: props.image.id,+ // reason: 'other',+ // description,+ // })+ })})diff --git a/test/unit/specs/components/ImageDetails/photo-details.spec.js b/test/unit/specs/components/ImageDetails/photo-details.spec.jsindex b99971fe0..3128235dd 100644--- a/test/unit/specs/components/ImageDetails/photo-details.spec.js+++ b/test/unit/specs/components/ImageDetails/photo-details.spec.js@@ -1,28 +1,26 @@-import PhotoDetails from '~/components/ImageDetails/PhotoDetails'+import VPhotoDetails from '~/components/ImageDetails/VPhotoDetails.vue'import {DETAIL_PAGE_EVENTS,SEND_DETAIL_PAGE_EVENT,} from '~/constants/usage-data-analytics-types'-import render from '../../../test-utils/render'-import i18n from '../../../test-utils/i18n'-import { REPORT_CONTENT, USAGE_DATA } from '~/constants/store-modules'-import { TOGGLE_REPORT_FORM_VISIBILITY } from '~/constants/mutation-types'--const stubs = {- ImageAttribution: true,- ContentReportForm: true,- ReuseSurvey: true,- ImageInfo: true,-}-+import { fireEvent, render, screen } from '@testing-library/vue'+import { USAGE_DATA } from '~/constants/store-modules'+import { createLocalVue } from '@vue/test-utils'+import Vuex from 'vuex'+import VueI18n from 'vue-i18n'+import messages from '~/locales/en.json'+const i18n = new VueI18n({+ locale: 'en',+ fallbackLocale: 'en',+ messages: { en: messages },+})describe('PhotoDetails', () => {let options = nulllet props = null- let storeState = null- let commitMock = null- let dispatchMock = null-- const $t = (key) => i18n.messages[key]+ let dispatchMock, routeMock, routerMock+ const localVue = createLocalVue()+ localVue.use(Vuex)+ localVue.use(VueI18n)beforeEach(() => {props = {@@ -38,139 +36,127 @@ describe('PhotoDetails', () => {creator: 'John',creator_url: 'http://creator.com',},+ shouldShowBreadcrumb: true,+ query: {+ q: 'foo',+ },}- commitMock = jest.fn()dispatchMock = jest.fn()-- storeState = {- $store: {- commit: commitMock,- dispatch: dispatchMock,- state: {- 'report-content': {- isReportFormVisible: false,- isReportSent: false,- reportFailed: false,- },- },+ routerMock = {+ push: jest.fn(),+ back: jest.fn(),+ }+ routeMock = {+ params: {+ location: window.scrollY,},}-+ const storeMock = new Vuex.Store({+ modules: {+ search: { namespaced: true, state: {} },+ provider: {+ namespaced: true,+ state: {},+ getters: { getProviderName: (val) => () => val },+ },+ 'usage-data': {+ namespaced: true,+ actions: { SEND_DETAIL_PAGE_EVENT: jest.fn() },+ },+ },+ })options = {+ localVue,propsData: props,- stubs,mocks: {- ...storeState,- $t,+ $nuxt: {+ context: {+ route: routeMock,+ router: routerMock,+ store: storeMock,+ },+ },},+ store: storeMock,+ i18n,}})it('should render correct contents', () => {- const wrapper = render(PhotoDetails, options)- expect(wrapper.find('.photo_image').element).toBeDefined()- expect(wrapper.find('[data-testid="image-info"]').exists()).toBe(true)- expect(wrapper.find('[data-testid="image-attribution"]').exists()).toBe(- true- )+ render(VPhotoDetails, options)+ expect(screen.findByAltText(props.image.title)).toBeTruthy()+ expect(screen.queryAllByText(props.image.title)).toHaveLength(1)})it('should generate license name', () => {- const wrapper = render(PhotoDetails, options)- expect(wrapper.vm.fullLicenseName).toBe('CC BY 1.0')+ render(VPhotoDetails, options)+ const licenseName = screen.queryAllByText(/CC BY 1.0/)++ expect(licenseName.length).toEqual(3)})it('should generate CC-0 license name', () => {options.propsData.image.license = 'cc0'- const wrapper = render(PhotoDetails, options)- expect(wrapper.vm.fullLicenseName).toBe('CC0 1.0')+ render(VPhotoDetails, options)+ const licenseElements = screen.queryAllByText(/CC0/i)++ expect(licenseElements.length).toEqual(4)})it('should generate CC-0 license name when license is CC0 uppercase', () => {options.propsData.image.license = 'CC0'- const wrapper = render(PhotoDetails, options)- expect(wrapper.vm.fullLicenseName).toBe('CC0 1.0')+ render(VPhotoDetails, options)+ const licenseElements = screen.queryAllByText(/CC0/i)+ expect(licenseElements.length).toEqual(4)})it('renders link back to search results if enabled', () => {options.propsData.shouldShowBreadcrumb = true- const wrapper = render(PhotoDetails, options)- expect(wrapper.find('.photo_breadcrumb').element).toBeDefined()+ render(VPhotoDetails, options)++ expect(screen.queryByText(/back/i)).toBeVisible()})- it('doesnt render link back to search results if disabled', () => {+ it('doesnt render link back to search results if disabled', async () => {options.propsData.shouldShowBreadcrumb = false- const wrapper = render(PhotoDetails, options)- expect(wrapper.find('.photo_breadcrumb').element).toBeUndefined()+ render(VPhotoDetails, options)++ expect(screen.queryByText(/back/i)).toBeNull()})it('renders image title', () => {- const wrapper = render(PhotoDetails, options)- expect(wrapper.html()).toContain(props.image.title)+ render(VPhotoDetails, options)++ expect(screen.queryAllByText(props.image.title).length).toEqual(1)})it('redirects back when clicking on the back to results link', async () => {- const routerMock = {- push: jest.fn(),- back: jest.fn(),- }- const routeMock = {- params: {- location: window.scrollY,- },- }- const opts = {- propsData: {- ...props,- shouldShowBreadcrumb: true,- query: {- q: 'foo',- },- },- stubs,- mocks: {- $router: routerMock,- $route: routeMock,- ...storeState,- $t,- },- }- const wrapper = render(PhotoDetails, opts)- const link = wrapper.find('.photo_breadcrumb')- await link.trigger('click')+ render(VPhotoDetails, options)+ const linkBack = screen.queryByText(/back/i)+ await fireEvent.click(linkBack)expect(routerMock.back).toHaveBeenCalled()})it('should toggle visibility of report form on report button click', async () => {- const wrapper = render(PhotoDetails, options)- const button = wrapper.find('.report')- await button.trigger('click')+ render(VPhotoDetails, options)+ await fireEvent.click(screen.queryByRole('button', { name: /report/i }))- expect(commitMock).toHaveBeenCalledWith(- `${REPORT_CONTENT}/${TOGGLE_REPORT_FORM_VISIBILITY}`- )+ expect(screen.queryAllByRole('radio').length).toBe(3)})it('report form should be invisible by default', () => {- const wrapper = render(PhotoDetails, options)-- expect(- wrapper.find('[data-testid="content-report-form"]').element- ).not.toBeDefined()- })-- it('report form should be visible when isReportFormVisible is true', () => {- storeState.$store.state.isReportFormVisible = true- const wrapper = render(PhotoDetails, options)+ render(VPhotoDetails, options)- expect(wrapper.find('#content-report-form')).toBeDefined()+ expect(screen.queryAllByRole('radio').length).toEqual(0)})- it('should dispatch SOURCE_CLICKED on source link clicked', () => {- const wrapper = render(PhotoDetails, options)- wrapper.vm.onPhotoSourceLinkClicked()+ it('should dispatch SOURCE_CLICKED on source link clicked', async () => {+ options.store.dispatch = dispatchMock+ render(VPhotoDetails, options)+ const sourceLink = screen.queryByTestId('source-button')+ await fireEvent.click(sourceLink)expect(dispatchMock).toHaveBeenCalledWith(`${USAGE_DATA}/${SEND_DETAIL_PAGE_EVENT}`,diff --git a/test/unit/specs/store/report-content-store.spec.js b/test/unit/specs/store/report-content-store.spec.jsdeleted file mode 100644index 09d38a64f..000000000--- a/test/unit/specs/store/report-content-store.spec.js+++ /dev/null@@ -1,106 +0,0 @@-import store, { createActions } from '~/store/report-content'-import {- TOGGLE_REPORT_FORM_VISIBILITY,- REPORT_SENT,- REPORT_FORM_CLOSED,- REPORT_ERROR,- BACK_TO_REPORT_START,-} from '~/constants/mutation-types'-import { SEND_CONTENT_REPORT } from '~/constants/action-types'--describe('Report Content Store', () => {- describe('state', () => {- it('exports default state', () => {- const state = store.state()- expect(state.isReportFormVisible).toBeFalsy()- expect(state.isReportSent).toBeFalsy()- expect(state.reportFailed).toBeFalsy()- })- })-- describe('mutations', () => {- const mutations = store.mutations- let state = null-- beforeEach(() => {- state = {}- })-- it('TOGGLE_REPORT_FORM_VISIBILITY toggles isReportFormVisible', () => {- mutations[TOGGLE_REPORT_FORM_VISIBILITY](state)-- expect(state.isReportFormVisible).toBeTruthy()-- mutations[TOGGLE_REPORT_FORM_VISIBILITY](state)- expect(state.isReportFormVisible).toBeFalsy()- })-- it('REPORT_SENT sets isReportSent to true', () => {- mutations[REPORT_SENT](state)-- expect(state.isReportSent).toBeTruthy()- })-- it('REPORT_ERROR sets reportFailed to true', () => {- mutations[REPORT_ERROR](state)-- expect(state.reportFailed).toBeTruthy()- })-- it('BACK_TO_REPORT_START resets reportSent and Failed state', () => {- state.isReportSent = true- state.reportFailed = true- mutations[BACK_TO_REPORT_START](state)-- expect(state.isReportSent).toBeFalsy()- expect(state.reportFailed).toBeFalsy()- })-- it('REPORT_FORM_CLOSED resets state', () => {- state.isReportSent = true- state.reportFailed = true- state.isReportFormVisible = true- mutations[REPORT_FORM_CLOSED](state)-- expect(state.isReportFormVisible).toBeFalsy()- expect(state.isReportSent).toBeFalsy()- expect(state.reportFailed).toBeFalsy()- })- })-- describe('actions', () => {- let actions = null- let reportServiceMock = null- let commit = null-- beforeEach(() => {- reportServiceMock = { sendReport: jest.fn(() => Promise.resolve({})) }- commit = jest.fn()-- actions = createActions(reportServiceMock)- })-- it('SEND_CONTENT_REPORT on success', (done) => {- const params = { foo: 'bar' }- const action = actions[SEND_CONTENT_REPORT]- action({ commit }, params).then(() => {- expect(reportServiceMock.sendReport).toBeCalledWith(params)- expect(commit).toBeCalledWith(REPORT_SENT)- done()- })- })-- it('SEND_CONTENT_REPORT on failure', (done) => {- reportServiceMock = { sendReport: jest.fn(() => Promise.reject({})) }- actions = createActions(reportServiceMock)-- const params = { foo: 'bar' }- const action = actions[SEND_CONTENT_REPORT]- action({ commit }, params).then(() => {- expect(reportServiceMock.sendReport).toBeCalledWith(params)- expect(commit).toBeCalledWith(REPORT_ERROR)- done()- })- })- })-})