diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e2946b162..6c607eeea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -157,7 +157,7 @@ e2e-pleroma: variables: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" FF_NETWORK_PER_BUILD: "true" - PLEROMA_IMAGE: git.pleroma.social/pleroma/pleroma:stable + PLEROMA_IMAGE: git.pleroma.social:5050/pleroma/pleroma:stable POSTGRES_USER: pleroma POSTGRES_PASSWORD: pleroma POSTGRES_DB: pleroma diff --git a/docker-compose.e2e.yml b/docker-compose.e2e.yml index c740e69c4..c49984684 100644 --- a/docker-compose.e2e.yml +++ b/docker-compose.e2e.yml @@ -12,7 +12,7 @@ services: retries: 30 pleroma: - image: ${PLEROMA_IMAGE:-git.pleroma.social/pleroma/pleroma:stable} + image: ${PLEROMA_IMAGE:-git.pleroma.social:5050/pleroma/pleroma:stable} environment: DB_USER: pleroma DB_PASS: pleroma diff --git a/src/api/admin.js b/src/api/admin.js index 67fb5038b..79eac9bd6 100644 --- a/src/api/admin.js +++ b/src/api/admin.js @@ -312,6 +312,9 @@ export const deleteAnnouncement = ({ id, credentials }) => }) export const setReportState = ({ id, state, credentials }) => { + // TODO: Can't use promisedRequest because on OK this does not return json + // See https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1322 + return promisedRequest({ url: REPORTS, credentials, @@ -325,6 +328,19 @@ export const setReportState = ({ id, state, credentials }) => { ], }, }) + .then((data) => { + if (data.status >= 500) { + throw Error(data.statusText) + } else if (data.status >= 400) { + return data.json() + } + return data + }) + .then((data) => { + if (data.errors) { + throw Error(data.errors[0].message) + } + }) } export const getInstanceDBConfig = ({ credentials }) => diff --git a/src/api/user.js b/src/api/user.js index b9035da77..ce41c0c21 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -842,6 +842,7 @@ export const getList = ({ listId, credentials }) => }) export const updateList = ({ listId, title, credentials }) => + console.log('PUT', MASTODON_LIST_URL(listId)) || promisedRequest({ url: MASTODON_LIST_URL(listId), diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 6cb99a3b6..4d9c34546 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -634,7 +634,6 @@ const PostStatusForm = { // Don't apply preview if not loading, because it means // user has closed the preview manually. if (!this.previewLoading) return - this.preview = data }) .catch((error) => { this.preview = { error } diff --git a/src/components/user_reporting_modal/user_reporting_modal.js b/src/components/user_reporting_modal/user_reporting_modal.js index 017a17efa..9659022d4 100644 --- a/src/components/user_reporting_modal/user_reporting_modal.js +++ b/src/components/user_reporting_modal/user_reporting_modal.js @@ -31,6 +31,7 @@ const UserReportingModal = { return !!this.$store.state.users.currentUser }, isOpen() { + console.log(this.reportModal) return this.isLoggedIn && this.reportModal.activated }, userId() { diff --git a/src/services/errors/errors.js b/src/services/errors/errors.js index ccbae9b3e..a28f31775 100644 --- a/src/services/errors/errors.js +++ b/src/services/errors/errors.js @@ -13,9 +13,9 @@ function humanizeErrors(errors) { export function StatusCodeError(statusCode, body, options, response) { this.name = 'StatusCodeError' this.statusCode = statusCode - this.statusText = body.error || body.errors || body + this.statusText = body.error || body this.details = JSON && JSON.stringify ? JSON.stringify(body) : body - this.errorData = body.error || body.errors + this.errorData = body.error this.message = this.statusCode + ' - ' + this.statusText this.error = body // legacy attribute this.options = options diff --git a/src/stores/oauth_tokens.js b/src/stores/oauth_tokens.js index 4d18ffae7..10aa371f9 100644 --- a/src/stores/oauth_tokens.js +++ b/src/stores/oauth_tokens.js @@ -4,11 +4,6 @@ import { useOAuthStore } from 'src/stores/oauth.js' import { fetchOAuthTokens, revokeOAuthToken } from 'src/api/user.js' -/* Just to clear the confusion: - * OAuth Store is responsible for user authentication - * OAuth Tokens Store is responsible for *managing* all of the user's tokens, - * i.e. for current and other clients - */ export const useOAuthTokensStore = defineStore('oauthTokens', { state: () => ({ tokens: [], diff --git a/test/fixtures/worker.js b/test/fixtures/worker.js index e6ed89dc9..e0db13ffc 100644 --- a/test/fixtures/worker.js +++ b/test/fixtures/worker.js @@ -2,4 +2,7 @@ import { setupWorker } from 'msw/browser' export const worker = setupWorker() +console.log('=============== TEST ===============') +console.log(window.__test__) +console.log('=============== TEST ===============') window.__test__ = window.__test__ || 'TEST' diff --git a/test/unit/specs/stores/lists.spec.js b/test/unit/specs/stores/lists.spec.js index bb1ef12b4..3720aa776 100644 --- a/test/unit/specs/stores/lists.spec.js +++ b/test/unit/specs/stores/lists.spec.js @@ -36,6 +36,7 @@ describe('The lists store', () => { HttpResponse.json({ ok: true }), ), ) + console.log('1 =========', worker.listHandlers()) await store.setList({ listId: list.id, title: list.title }) expect(store.allListsObject[list.id]).to.eql({ @@ -45,6 +46,8 @@ describe('The lists store', () => { expect(store.allLists).to.have.length(1) expect(store.allLists[0]).to.eql(list) + console.log('2 =========', worker.listHandlers()) + await store.setList({ listId: modList.id, title: modList.title }) expect(store.allListsObject[modList.id]).to.eql({ title: modList.title, @@ -52,6 +55,8 @@ describe('The lists store', () => { }) expect(store.allLists).to.have.length(1) expect(store.allLists[0]).to.eql(modList) + + console.log('3 =========', worker.listHandlers()) }) it('adds a new list with an array of IDs, updating the IDs for existing lists', async ({ diff --git a/test/unit/specs/stores/oauth.spec.js b/test/unit/specs/stores/oauth.spec.js index a06cbb2fd..6e61fea79 100644 --- a/test/unit/specs/stores/oauth.spec.js +++ b/test/unit/specs/stores/oauth.spec.js @@ -155,6 +155,7 @@ describe('oauth store', () => { describe('ensureAppToken', () => { it('should work if the state is empty', async ({ worker }) => { worker.use(...authApis()) + console.log('=========', worker.listHandlers()) const store = useOAuthStore() const token = await store.ensureAppToken() expect(token).to.eql('test-app-token') diff --git a/tools/e2e/run.sh b/tools/e2e/run.sh index 452302cbd..3c0ba8a36 100644 --- a/tools/e2e/run.sh +++ b/tools/e2e/run.sh @@ -5,7 +5,7 @@ set -u COMPOSE_FILE="docker-compose.e2e.yml" : "${COMPOSE_MENU:=false}" -: "${PLEROMA_IMAGE:=git.pleroma.social/pleroma/pleroma:stable}" +: "${PLEROMA_IMAGE:=git.pleroma.social:5050/pleroma/pleroma:stable}" : "${E2E_ADMIN_USERNAME:=admin}" : "${E2E_ADMIN_PASSWORD:=adminadmin}" : "${E2E_ADMIN_EMAIL:=admin@example.com}"