diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index 0a44d7a15..97f2e78e7 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -97,7 +97,7 @@ export default { WITH post MATCH (author:User {id: $userId}) MERGE (post)<-[:WROTE]-(author) - WITH post, author + WITH post UNWIND $categoryIds AS categoryId MATCH (category:Category {id: categoryId}) MERGE (post)-[:CATEGORIZED]->(category) @@ -108,9 +108,7 @@ export default { const session = context.driver.session() try { const transactionRes = await session.run(createPostCypher, createPostVariables) - const posts = transactionRes.records.map(record => { - return record.get('post').properties - }) + const posts = transactionRes.records.map(record => record.get('post').properties) post = posts[0] } catch (e) { if (e.code === 'Neo.ClientError.Schema.ConstraintValidationFailed') @@ -124,9 +122,6 @@ export default { }, UpdatePost: async (_parent, params, context, _resolveInfo) => { const { categoryIds } = params - const { id: userId } = context.user - delete params.pinned - delete params.unpinned delete params.categoryIds params = await fileUpload(params, { file: 'imageUpload', url: 'image' }) const session = context.driver.session() @@ -154,7 +149,7 @@ export default { } updatePostCypher += `RETURN post` - const updatePostVariables = { categoryIds, params, userId } + const updatePostVariables = { categoryIds, params } const transactionRes = await session.run(updatePostCypher, updatePostVariables) const [post] = transactionRes.records.map(record => { @@ -287,7 +282,7 @@ export default { }, Post: { ...Resolver('Post', { - undefinedToNull: ['activityId', 'objectId', 'image', 'language'], + undefinedToNull: ['activityId', 'objectId', 'image', 'language', 'pinnedAt'], hasMany: { tags: '-[:TAGGED]->(related:Tag)', categories: '-[:CATEGORIZED]->(related:Category)', diff --git a/cypress/integration/common/report.js b/cypress/integration/common/report.js index cb29f114d..c32d5e10a 100644 --- a/cypress/integration/common/report.js +++ b/cypress/integration/common/report.js @@ -67,11 +67,13 @@ When('I click on the author', () => { }) When('I report the author', () => { - cy.get('.page-name-profile-id-slug') - invokeReportOnElement('.ds-card') - cy.get('button') - .contains('Send') - .click() + cy.get('.page-name-profile-id-slug').then(() => { + invokeReportOnElement('.ds-card').then(() => { + cy.get('button') + .contains('Send') + .click() + }) + }) }) When('I click on send in the confirmation dialog', () => { @@ -85,10 +87,11 @@ Then('I get a success message', () => { }) Then('I see my reported user', () => { - cy.get('table') - cy.get('tbody tr') - .first() - .contains(lastReportTitle.trim()) + cy.get('table').then(() => { + cy.get('tbody tr') + .first() + .contains(lastReportTitle.trim()) + }) }) Then(`I can't see the moderation menu item`, () => { diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 51dcd2126..51ba950a6 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -36,8 +36,15 @@ const authenticatedHeaders = async (variables) => { } Cypress.Commands.add("switchLanguage", (name, force) => { + const { code } = helpers.getLangByName(name); if (force) { switchLang(name); + } else { + cy.get("html").then($html => { + if ($html && $html.attr("lang") !== code) { + switchLang(name); + } + }); } }); diff --git a/webapp/components/notifications/NotificationMenu/NotificationMenu.vue b/webapp/components/notifications/NotificationMenu/NotificationMenu.vue index 9c3ed0bd7..26d8256bd 100644 --- a/webapp/components/notifications/NotificationMenu/NotificationMenu.vue +++ b/webapp/components/notifications/NotificationMenu/NotificationMenu.vue @@ -93,7 +93,7 @@ export default { return data.notifications }, error(error) { - this.$toast.error(error) + this.$toast.error(error.message) }, }, }, diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 987faf36d..0fdea08db 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -79,7 +79,6 @@