mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Update cypress tests, post query
This commit is contained in:
parent
7bbbf40bcc
commit
8735045d11
@ -83,17 +83,14 @@ export default {
|
|||||||
|
|
||||||
await session.run(cypherDeletePreviousRelations, { params })
|
await session.run(cypherDeletePreviousRelations, { params })
|
||||||
|
|
||||||
let updatePostCypher = `MATCH (post:Post {id: $params.id})
|
const updatePostCypher = `MATCH (post:Post {id: $params.id})
|
||||||
SET post = $params
|
SET post = $params
|
||||||
`
|
WITH post
|
||||||
if (categoryIds && categoryIds.length) {
|
UNWIND $categoryIds AS categoryId
|
||||||
updatePostCypher += `WITH post
|
MATCH (category:Category {id: categoryId})
|
||||||
UNWIND $categoryIds AS categoryId
|
MERGE (post)-[:CATEGORIZED]->(category)
|
||||||
MATCH (category:Category {id: categoryId})
|
RETURN post`
|
||||||
MERGE (post)-[:CATEGORIZED]->(category)
|
|
||||||
`
|
|
||||||
}
|
|
||||||
updatePostCypher += `RETURN post`
|
|
||||||
const updatePostVariables = { categoryIds, params }
|
const updatePostVariables = { categoryIds, params }
|
||||||
|
|
||||||
const transactionRes = await session.run(updatePostCypher, updatePostVariables)
|
const transactionRes = await session.run(updatePostCypher, updatePostVariables)
|
||||||
@ -110,22 +107,18 @@ export default {
|
|||||||
const { categoryIds } = params
|
const { categoryIds } = params
|
||||||
delete params.categoryIds
|
delete params.categoryIds
|
||||||
params = await fileUpload(params, { file: 'imageUpload', url: 'image' })
|
params = await fileUpload(params, { file: 'imageUpload', url: 'image' })
|
||||||
|
|
||||||
params.id = params.id || uuid()
|
params.id = params.id || uuid()
|
||||||
|
|
||||||
let createPostCypher = `CREATE (post:Post {params})
|
const createPostCypher = `CREATE (post:Post {params})
|
||||||
WITH post
|
WITH post
|
||||||
MATCH (author:User {id: $userId})
|
MATCH (author:User {id: $userId})
|
||||||
MERGE (post)<-[:WROTE]-(author)
|
MERGE (post)<-[:WROTE]-(author)
|
||||||
`
|
WITH post
|
||||||
if (categoryIds) {
|
|
||||||
createPostCypher += `WITH post
|
|
||||||
UNWIND $categoryIds AS categoryId
|
UNWIND $categoryIds AS categoryId
|
||||||
MATCH (category:Category {id: categoryId})
|
MATCH (category:Category {id: categoryId})
|
||||||
MERGE (post)-[:CATEGORIZED]->(category)
|
MERGE (post)-[:CATEGORIZED]->(category)
|
||||||
`
|
RETURN post`
|
||||||
}
|
|
||||||
createPostCypher += `RETURN post`
|
|
||||||
const createPostVariables = { userId: context.user.id, categoryIds, params }
|
const createPostVariables = { userId: context.user.id, categoryIds, params }
|
||||||
|
|
||||||
const session = context.driver.session()
|
const session = context.driver.session()
|
||||||
|
|||||||
@ -74,22 +74,22 @@ beforeEach(async () => {
|
|||||||
}
|
}
|
||||||
await factory.create('User', userParams)
|
await factory.create('User', userParams)
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
factory.create('Category', {
|
instance.create('Category', {
|
||||||
id: 'cat9',
|
id: 'cat9',
|
||||||
name: 'Democracy & Politics',
|
name: 'Democracy & Politics',
|
||||||
icon: 'university',
|
icon: 'university',
|
||||||
}),
|
}),
|
||||||
factory.create('Category', {
|
instance.create('Category', {
|
||||||
id: 'cat4',
|
id: 'cat4',
|
||||||
name: 'Environment & Nature',
|
name: 'Environment & Nature',
|
||||||
icon: 'tree',
|
icon: 'tree',
|
||||||
}),
|
}),
|
||||||
factory.create('Category', {
|
instance.create('Category', {
|
||||||
id: 'cat15',
|
id: 'cat15',
|
||||||
name: 'Consumption & Sustainability',
|
name: 'Consumption & Sustainability',
|
||||||
icon: 'shopping-cart',
|
icon: 'shopping-cart',
|
||||||
}),
|
}),
|
||||||
factory.create('Category', {
|
instance.create('Category', {
|
||||||
id: 'cat27',
|
id: 'cat27',
|
||||||
name: 'Animal Protection',
|
name: 'Animal Protection',
|
||||||
icon: 'paw',
|
icon: 'paw',
|
||||||
|
|||||||
@ -15,7 +15,9 @@ Feature: Tags and Categories
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given my user account has the role "admin"
|
Given my user account has the role "admin"
|
||||||
And we have a selection of tags and categories as well as posts
|
And we have a selection of categories
|
||||||
|
And we have a selection of tags
|
||||||
|
And we have a selection of posts
|
||||||
And I am logged in
|
And I am logged in
|
||||||
|
|
||||||
Scenario: See an overview of categories
|
Scenario: See an overview of categories
|
||||||
@ -24,8 +26,8 @@ Feature: Tags and Categories
|
|||||||
Then I can see the following table:
|
Then I can see the following table:
|
||||||
| | Name | Posts |
|
| | Name | Posts |
|
||||||
| | Just For Fun | 2 |
|
| | Just For Fun | 2 |
|
||||||
| | Happyness & Values | 1 |
|
| | Happiness & Values | 1 |
|
||||||
| | Health & Wellbeing | 0 |
|
| | Health & Wellbeing | 1 |
|
||||||
|
|
||||||
Scenario: See an overview of tags
|
Scenario: See an overview of tags
|
||||||
When I navigate to the administration dashboard
|
When I navigate to the administration dashboard
|
||||||
|
|||||||
@ -20,20 +20,19 @@ const narratorParams = {
|
|||||||
Given("I am logged in", () => {
|
Given("I am logged in", () => {
|
||||||
cy.login(loginCredentials);
|
cy.login(loginCredentials);
|
||||||
});
|
});
|
||||||
|
Given("we have a selection of categories", () => {
|
||||||
Given("we have a selection of tags and categories as well as posts", () => {
|
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.authenticateAs(loginCredentials)
|
.authenticateAs(loginCredentials)
|
||||||
.create("Category", {
|
.create("Category", {
|
||||||
id: "cat1",
|
id: "cat1",
|
||||||
name: "Just For Fun",
|
name: "Just For Fun",
|
||||||
slug: "justforfun",
|
slug: "just-for-fun",
|
||||||
icon: "smile"
|
icon: "smile"
|
||||||
})
|
})
|
||||||
.create("Category", {
|
.create("Category", {
|
||||||
id: "cat2",
|
id: "cat2",
|
||||||
name: "Happyness & Values",
|
name: "Happiness & Values",
|
||||||
slug: "happyness-values",
|
slug: "happiness-values",
|
||||||
icon: "heart-o"
|
icon: "heart-o"
|
||||||
})
|
})
|
||||||
.create("Category", {
|
.create("Category", {
|
||||||
@ -41,11 +40,18 @@ Given("we have a selection of tags and categories as well as posts", () => {
|
|||||||
name: "Health & Wellbeing",
|
name: "Health & Wellbeing",
|
||||||
slug: "health-wellbeing",
|
slug: "health-wellbeing",
|
||||||
icon: "medkit"
|
icon: "medkit"
|
||||||
})
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Given("we have a selection of tags", () => {
|
||||||
|
cy.factory()
|
||||||
|
.authenticateAs(loginCredentials)
|
||||||
.create("Tag", { id: "Ecology" })
|
.create("Tag", { id: "Ecology" })
|
||||||
.create("Tag", { id: "Nature" })
|
.create("Tag", { id: "Nature" })
|
||||||
.create("Tag", { id: "Democracy" });
|
.create("Tag", { id: "Democracy" });
|
||||||
|
});
|
||||||
|
|
||||||
|
Given("we have a selection of posts", () => {
|
||||||
const someAuthor = {
|
const someAuthor = {
|
||||||
id: "authorId",
|
id: "authorId",
|
||||||
email: "author@example.org",
|
email: "author@example.org",
|
||||||
@ -59,18 +65,15 @@ Given("we have a selection of tags and categories as well as posts", () => {
|
|||||||
cy.factory()
|
cy.factory()
|
||||||
.create("User", someAuthor)
|
.create("User", someAuthor)
|
||||||
.authenticateAs(someAuthor)
|
.authenticateAs(someAuthor)
|
||||||
.create("Post", { id: "p0" })
|
.create("Post", { id: "p0", categoryIds: ["cat1"] })
|
||||||
.create("Post", { id: "p1" });
|
.create("Post", { id: "p1", categoryIds: ["cat2"] });
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.create("User", yetAnotherAuthor)
|
.create("User", yetAnotherAuthor)
|
||||||
.authenticateAs(yetAnotherAuthor)
|
.authenticateAs(yetAnotherAuthor)
|
||||||
.create("Post", { id: "p2" });
|
.create("Post", { id: "p2", categoryIds: ["cat1"] });
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.authenticateAs(loginCredentials)
|
.authenticateAs(loginCredentials)
|
||||||
.create("Post", { id: "p3" })
|
.create("Post", { id: "p3", categoryIds: ["cat3"] })
|
||||||
.relate("Post", "Categories", { from: "p0", to: "cat1" })
|
|
||||||
.relate("Post", "Categories", { from: "p1", to: "cat2" })
|
|
||||||
.relate("Post", "Categories", { from: "p2", to: "cat1" })
|
|
||||||
.relate("Post", "Tags", { from: "p0", to: "Ecology" })
|
.relate("Post", "Tags", { from: "p0", to: "Ecology" })
|
||||||
.relate("Post", "Tags", { from: "p0", to: "Nature" })
|
.relate("Post", "Tags", { from: "p0", to: "Nature" })
|
||||||
.relate("Post", "Tags", { from: "p0", to: "Democracy" })
|
.relate("Post", "Tags", { from: "p0", to: "Democracy" })
|
||||||
@ -182,9 +185,17 @@ Given("we have the following posts in our database:", table => {
|
|||||||
};
|
};
|
||||||
postAttributes.deleted = Boolean(postAttributes.deleted);
|
postAttributes.deleted = Boolean(postAttributes.deleted);
|
||||||
const disabled = Boolean(postAttributes.disabled);
|
const disabled = Boolean(postAttributes.disabled);
|
||||||
|
postAttributes.categoryIds = [`cat${i}`];
|
||||||
|
postAttributes;
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.create("User", userAttributes)
|
.create("User", userAttributes)
|
||||||
.authenticateAs(userAttributes)
|
.authenticateAs(userAttributes)
|
||||||
|
.create("Category", {
|
||||||
|
id: `cat${i}`,
|
||||||
|
name: "Just For Fun",
|
||||||
|
slug: `just-for-fun-${i}`,
|
||||||
|
icon: "smile"
|
||||||
|
})
|
||||||
.create("Post", postAttributes);
|
.create("Post", postAttributes);
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
const moderatorParams = {
|
const moderatorParams = {
|
||||||
@ -218,6 +229,7 @@ When(
|
|||||||
Given("I previously created a post", () => {
|
Given("I previously created a post", () => {
|
||||||
lastPost.title = "previously created post";
|
lastPost.title = "previously created post";
|
||||||
lastPost.content = "with some content";
|
lastPost.content = "with some content";
|
||||||
|
lastPost.categoryIds = "cat1";
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.authenticateAs(loginCredentials)
|
.authenticateAs(loginCredentials)
|
||||||
.create("Post", lastPost);
|
.create("Post", lastPost);
|
||||||
@ -233,6 +245,12 @@ When("I type in the following text:", text => {
|
|||||||
cy.get(".editor .ProseMirror").type(lastPost.content);
|
cy.get(".editor .ProseMirror").type(lastPost.content);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Then("I select a category", () => {
|
||||||
|
cy.get("span")
|
||||||
|
.contains("Just for Fun")
|
||||||
|
.click();
|
||||||
|
});
|
||||||
|
|
||||||
Then("the post shows up on the landing page at position {int}", index => {
|
Then("the post shows up on the landing page at position {int}", index => {
|
||||||
cy.openPage("landing");
|
cy.openPage("landing");
|
||||||
const selector = `.post-card:nth-child(${index}) > .ds-card-content`;
|
const selector = `.post-card:nth-child(${index}) > .ds-card-content`;
|
||||||
@ -260,7 +278,9 @@ Then("the first post on the landing page has the title:", title => {
|
|||||||
Then(
|
Then(
|
||||||
"the page {string} returns a 404 error with a message:",
|
"the page {string} returns a 404 error with a message:",
|
||||||
(route, message) => {
|
(route, message) => {
|
||||||
cy.request({ url: route, failOnStatusCode: false }).its('status').should('eq', 404)
|
cy.request({ url: route, failOnStatusCode: false })
|
||||||
|
.its("status")
|
||||||
|
.should("eq", 404);
|
||||||
cy.visit(route, { failOnStatusCode: false });
|
cy.visit(route, { failOnStatusCode: false });
|
||||||
cy.get(".error").should("contain", message);
|
cy.get(".error").should("contain", message);
|
||||||
}
|
}
|
||||||
@ -422,7 +442,7 @@ Given('"Spammy Spammer" wrote a post {string}', title => {
|
|||||||
email: "spammy-spammer@example.org",
|
email: "spammy-spammer@example.org",
|
||||||
password: "1234"
|
password: "1234"
|
||||||
})
|
})
|
||||||
.create("Post", { title });
|
.create("Post", { title, categoryIds: ["cat2"] });
|
||||||
});
|
});
|
||||||
|
|
||||||
Then("the list of posts of this user is empty", () => {
|
Then("the list of posts of this user is empty", () => {
|
||||||
@ -441,7 +461,7 @@ Then("nobody is following the user profile anymore", () => {
|
|||||||
Given("I wrote a post {string}", title => {
|
Given("I wrote a post {string}", title => {
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.authenticateAs(loginCredentials)
|
.authenticateAs(loginCredentials)
|
||||||
.create("Post", { title });
|
.create("Post", { title, categoryIds: ["cat2"] });
|
||||||
});
|
});
|
||||||
|
|
||||||
When("I block the user {string}", name => {
|
When("I block the user {string}", name => {
|
||||||
@ -466,3 +486,14 @@ Then("I see only one post with the title {string}", title => {
|
|||||||
.should("have.length", 1);
|
.should("have.length", 1);
|
||||||
cy.get(".main-container").contains(".post-link", title);
|
cy.get(".main-container").contains(".post-link", title);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
And("some categories exist", () => {
|
||||||
|
cy.factory()
|
||||||
|
.authenticateAs(loginCredentials)
|
||||||
|
.create("Category", {
|
||||||
|
id: "cat1",
|
||||||
|
name: "Just For Fun",
|
||||||
|
slug: `just-for-fun`,
|
||||||
|
icon: "smile"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@ -7,20 +7,20 @@ Feature: Hide Posts
|
|||||||
Given we have the following posts in our database:
|
Given we have the following posts in our database:
|
||||||
| id | title | deleted | disabled |
|
| id | title | deleted | disabled |
|
||||||
| p1 | This post should be visible | | |
|
| p1 | This post should be visible | | |
|
||||||
| p2 | This post is disabled | | x |
|
| p2 | This post is disabled | | x |
|
||||||
| p3 | This post is deleted | x | |
|
| p3 | This post is deleted | x | |
|
||||||
|
|
||||||
Scenario: Disabled posts don't show up on the landing page
|
Scenario: Disabled posts don't show up on the landing page
|
||||||
Given I am logged in with a "user" role
|
Given I am logged in with a "user" role
|
||||||
Then I should see only 1 post on the landing page
|
Then I should see only 1 post on the landing page
|
||||||
And the first post on the landing page has the title:
|
And the first post on the landing page has the title:
|
||||||
"""
|
"""
|
||||||
This post should be visible
|
This post should be visible
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Scenario: Visiting a disabled post's page should return 404
|
Scenario: Visiting a disabled post's page should return 404
|
||||||
Given I am logged in with a "user" role
|
Given I am logged in with a "user" role
|
||||||
Then the page "/post/this-post-is-disabled" returns a 404 error with a message:
|
Then the page "/post/this-post-is-disabled" returns a 404 error with a message:
|
||||||
"""
|
"""
|
||||||
This post could not be found
|
This post could not be found
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -6,6 +6,7 @@ Feature: Create a post
|
|||||||
Background:
|
Background:
|
||||||
Given I have a user account
|
Given I have a user account
|
||||||
And I am logged in
|
And I am logged in
|
||||||
|
And we have a selection of categories
|
||||||
And I am on the "landing" page
|
And I am on the "landing" page
|
||||||
|
|
||||||
Scenario: Create a post
|
Scenario: Create a post
|
||||||
@ -16,6 +17,7 @@ Feature: Create a post
|
|||||||
Human Connection is a free and open-source social network
|
Human Connection is a free and open-source social network
|
||||||
for active citizenship.
|
for active citizenship.
|
||||||
"""
|
"""
|
||||||
|
Then I select a category
|
||||||
And I click on "Save"
|
And I click on "Save"
|
||||||
Then I get redirected to ".../my-first-post"
|
Then I get redirected to ".../my-first-post"
|
||||||
And the post was saved successfully
|
And the post was saved successfully
|
||||||
|
|||||||
@ -7,6 +7,7 @@ Feature: Block a User
|
|||||||
Given I have a user account
|
Given I have a user account
|
||||||
And there is an annoying user called "Spammy Spammer"
|
And there is an annoying user called "Spammy Spammer"
|
||||||
And I am logged in
|
And I am logged in
|
||||||
|
And we have a selection of categories
|
||||||
|
|
||||||
Scenario: Block a user
|
Scenario: Block a user
|
||||||
Given I am on the profile page of the annoying user
|
Given I am on the profile page of the annoying user
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import CategoryQuery from '~/graphql/CategoryQuery.js'
|
import CategoryQuery from '~/graphql/CategoryQuery'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -87,8 +87,8 @@ export default {
|
|||||||
query() {
|
query() {
|
||||||
return CategoryQuery()
|
return CategoryQuery()
|
||||||
},
|
},
|
||||||
result(result) {
|
result({ data: { Category } }) {
|
||||||
this.categories = result.data.Category
|
this.categories = Category
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -17,8 +17,8 @@
|
|||||||
<no-ssr>
|
<no-ssr>
|
||||||
<hc-editor
|
<hc-editor
|
||||||
:users="users"
|
:users="users"
|
||||||
:hashtags="hashtags"
|
|
||||||
:value="form.content"
|
:value="form.content"
|
||||||
|
:hashtags="hashtags"
|
||||||
@input="updateEditorContent"
|
@input="updateEditorContent"
|
||||||
/>
|
/>
|
||||||
<small class="smallTag">{{ form.contentLength }}/{{ contentMax }}</small>
|
<small class="smallTag">{{ form.contentLength }}/{{ contentMax }}</small>
|
||||||
@ -177,8 +177,8 @@ export default {
|
|||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.$toast.success(this.$t('contribution.success'))
|
this.$toast.success(this.$t('contribution.success'))
|
||||||
this.failedValidations = true
|
|
||||||
const result = data[this.id ? 'UpdatePost' : 'CreatePost']
|
const result = data[this.id ? 'UpdatePost' : 'CreatePost']
|
||||||
|
this.failedValidations = false
|
||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'post-id-slug',
|
name: 'post-id-slug',
|
||||||
@ -188,7 +188,7 @@ export default {
|
|||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.$toast.error(err.message)
|
this.$toast.error(err.message)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.failedValidations = false
|
this.failedValidations = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
updateEditorContent(value) {
|
updateEditorContent(value) {
|
||||||
@ -234,7 +234,7 @@ export default {
|
|||||||
User: {
|
User: {
|
||||||
query() {
|
query() {
|
||||||
return gql`
|
return gql`
|
||||||
{
|
query {
|
||||||
User(orderBy: slug_asc) {
|
User(orderBy: slug_asc) {
|
||||||
id
|
id
|
||||||
slug
|
slug
|
||||||
@ -242,22 +242,22 @@ export default {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
result(result) {
|
result({ data: { User } }) {
|
||||||
this.users = result.data.User
|
this.users = User
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Tag: {
|
Tag: {
|
||||||
query() {
|
query() {
|
||||||
return gql`
|
return gql`
|
||||||
{
|
query {
|
||||||
Tag(orderBy: id_asc) {
|
Tag(orderBy: id_asc) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
result(result) {
|
result({ data: { Tag } }) {
|
||||||
this.hashtags = result.data.Tag
|
this.hashtags = Tag
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
return gql(`{
|
return gql`
|
||||||
Category {
|
query {
|
||||||
id
|
Category {
|
||||||
slug
|
id
|
||||||
icon
|
slug
|
||||||
|
icon
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}`)
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,16 +3,46 @@ import gql from 'graphql-tag'
|
|||||||
export default i18n => {
|
export default i18n => {
|
||||||
const lang = i18n.locale().toUpperCase()
|
const lang = i18n.locale().toUpperCase()
|
||||||
return gql`
|
return gql`
|
||||||
query Post($slug: String!) {
|
query Post($id: ID!) {
|
||||||
Post(slug: $slug) {
|
Post(id: $id) {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
content
|
||||||
|
createdAt
|
||||||
|
disabled
|
||||||
|
deleted
|
||||||
|
slug
|
||||||
|
image
|
||||||
|
author {
|
||||||
id
|
id
|
||||||
title
|
slug
|
||||||
|
name
|
||||||
|
avatar
|
||||||
|
disabled
|
||||||
|
deleted
|
||||||
|
shoutedCount
|
||||||
|
contributionsCount
|
||||||
|
commentedCount
|
||||||
|
followedByCount
|
||||||
|
followedByCurrentUser
|
||||||
|
location {
|
||||||
|
name: name${lang}
|
||||||
|
}
|
||||||
|
badges {
|
||||||
|
id
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tags {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
comments(orderBy: createdAt_asc) {
|
||||||
|
id
|
||||||
|
contentExcerpt
|
||||||
content
|
content
|
||||||
createdAt
|
createdAt
|
||||||
disabled
|
disabled
|
||||||
deleted
|
deleted
|
||||||
slug
|
|
||||||
image
|
|
||||||
author {
|
author {
|
||||||
id
|
id
|
||||||
slug
|
slug
|
||||||
@ -33,48 +63,18 @@ export default i18n => {
|
|||||||
icon
|
icon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tags {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
comments(orderBy: createdAt_asc) {
|
|
||||||
id
|
|
||||||
contentExcerpt
|
|
||||||
content
|
|
||||||
createdAt
|
|
||||||
disabled
|
|
||||||
deleted
|
|
||||||
author {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
name
|
|
||||||
avatar
|
|
||||||
disabled
|
|
||||||
deleted
|
|
||||||
shoutedCount
|
|
||||||
contributionsCount
|
|
||||||
commentedCount
|
|
||||||
followedByCount
|
|
||||||
followedByCurrentUser
|
|
||||||
location {
|
|
||||||
name: name${lang}
|
|
||||||
}
|
|
||||||
badges {
|
|
||||||
id
|
|
||||||
icon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
categories {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
icon
|
|
||||||
}
|
|
||||||
shoutedCount
|
|
||||||
shoutedByCurrentUser
|
|
||||||
emotionsCount
|
|
||||||
}
|
}
|
||||||
|
categories {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
shoutedCount
|
||||||
|
shoutedByCurrentUser
|
||||||
|
emotionsCount
|
||||||
}
|
}
|
||||||
`
|
}
|
||||||
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const filterPosts = i18n => {
|
export const filterPosts = i18n => {
|
||||||
|
|||||||
@ -159,7 +159,7 @@ export default {
|
|||||||
},
|
},
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
slug: this.$route.params.slug,
|
id: this.$route.params.id,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetchPolicy: 'cache-and-network',
|
fetchPolicy: 'cache-and-network',
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import gql from 'graphql-tag'
|
|
||||||
import HcContributionForm from '~/components/ContributionForm/ContributionForm'
|
import HcContributionForm from '~/components/ContributionForm/ContributionForm'
|
||||||
|
import PostQuery from '~/graphql/PostQuery'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -36,38 +36,11 @@ export default {
|
|||||||
apollo: {
|
apollo: {
|
||||||
Post: {
|
Post: {
|
||||||
query() {
|
query() {
|
||||||
return gql(`
|
return PostQuery(this.$i18n)
|
||||||
query($id: ID!) {
|
|
||||||
Post(id: $id) {
|
|
||||||
id
|
|
||||||
title
|
|
||||||
content
|
|
||||||
createdAt
|
|
||||||
disabled
|
|
||||||
deleted
|
|
||||||
slug
|
|
||||||
image
|
|
||||||
language
|
|
||||||
author {
|
|
||||||
id
|
|
||||||
disabled
|
|
||||||
deleted
|
|
||||||
}
|
|
||||||
tags {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
categories {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
icon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
},
|
},
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
id: this.$route.params.id || 'p1',
|
id: this.$route.params.id,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetchPolicy: 'cache-and-network',
|
fetchPolicy: 'cache-and-network',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user