mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Resolve pinnedAt undefinedToNull, clean up
- this was causing the noftications to break since they were using the post fragment and pinnedAt was returning null - remove unused bits of code - revert changes to cypress since they were not causing the error - can be changed in another PR
This commit is contained in:
parent
8b27250393
commit
b800c7d5c9
@ -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)',
|
||||
|
||||
@ -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`, () => {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ export default {
|
||||
return data.notifications
|
||||
},
|
||||
error(error) {
|
||||
this.$toast.error(error)
|
||||
this.$toast.error(error.message)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -79,7 +79,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import ContentViewer from '~/components/Editor/ContentViewer'
|
||||
import HcCategory from '~/components/Category'
|
||||
import HcHashtag from '~/components/Hashtag/Hashtag'
|
||||
@ -145,9 +144,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapMutations({
|
||||
setCurrentUser: 'auth/SET_USER',
|
||||
}),
|
||||
isAuthor(id) {
|
||||
return this.$store.getters['auth/user'].id === id
|
||||
},
|
||||
@ -163,11 +159,6 @@ export default {
|
||||
async createComment(comment) {
|
||||
this.post.comments.push(comment)
|
||||
},
|
||||
resetPostList() {
|
||||
this.offset = 0
|
||||
this.posts = []
|
||||
this.hasMore = true
|
||||
},
|
||||
pinPost(post) {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user