mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Update cypress tests, fix broken comment reactivity
This commit is contained in:
parent
8735045d11
commit
512bf32b0c
@ -102,11 +102,13 @@ export default class ActivityPub {
|
||||
handleUndoActivity(activity) {
|
||||
debug('inside UNDO')
|
||||
switch (activity.object.type) {
|
||||
case 'Follow':
|
||||
case 'Follow': {
|
||||
const followActivity = activity.object
|
||||
return this.dataSource.undoFollowActivity(followActivity.actor, followActivity.object)
|
||||
case 'Like':
|
||||
}
|
||||
case 'Like': {
|
||||
return this.dataSource.deleteShouted(activity)
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
@ -115,13 +117,14 @@ export default class ActivityPub {
|
||||
debug('inside create')
|
||||
switch (activity.object.type) {
|
||||
case 'Article':
|
||||
case 'Note':
|
||||
case 'Note': {
|
||||
const articleObject = activity.object
|
||||
if (articleObject.inReplyTo) {
|
||||
return this.dataSource.createComment(activity)
|
||||
} else {
|
||||
return this.dataSource.createPost(activity)
|
||||
}
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
@ -159,7 +162,7 @@ export default class ActivityPub {
|
||||
async handleAcceptActivity(activity) {
|
||||
debug('inside accept')
|
||||
switch (activity.object.type) {
|
||||
case 'Follow':
|
||||
case 'Follow': {
|
||||
const followObject = activity.object
|
||||
const followingCollectionPage = await this.collections.getFollowingCollectionPage(
|
||||
followObject.actor,
|
||||
@ -168,6 +171,7 @@ export default class ActivityPub {
|
||||
await this.dataSource.saveFollowingCollectionPage(followingCollectionPage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getActorObject(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
@ -51,7 +51,7 @@ export function createSignature(options) {
|
||||
// verifying
|
||||
export function verifySignature(url, headers) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const signatureHeader = headers['signature'] ? headers['signature'] : headers['Signature']
|
||||
const signatureHeader = headers.signature ? headers.signature : headers.Signature
|
||||
if (!signatureHeader) {
|
||||
debug('No Signature header present!')
|
||||
resolve(false)
|
||||
|
||||
@ -21,8 +21,7 @@ Given("I am logged in", () => {
|
||||
cy.login(loginCredentials);
|
||||
});
|
||||
Given("we have a selection of categories", () => {
|
||||
cy.factory()
|
||||
.authenticateAs(loginCredentials)
|
||||
cy.neode()
|
||||
.create("Category", {
|
||||
id: "cat1",
|
||||
name: "Just For Fun",
|
||||
@ -374,7 +373,7 @@ When("mention {string} in the text", mention => {
|
||||
});
|
||||
|
||||
Then("the notification gets marked as read", () => {
|
||||
cy.get(".notification")
|
||||
cy.get(".post.createdAt")
|
||||
.first()
|
||||
.should("have.class", "read");
|
||||
});
|
||||
@ -486,14 +485,3 @@ Then("I see only one post with the title {string}", title => {
|
||||
.should("have.length", 1);
|
||||
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"
|
||||
});
|
||||
});
|
||||
|
||||
@ -4,6 +4,7 @@ Feature: Notifications for a mentions
|
||||
In order join conversations about or related to me
|
||||
|
||||
Background:
|
||||
Given we have a selection of categories
|
||||
Given we have the following user accounts:
|
||||
| name | slug | email | password |
|
||||
| Wolle aus Hamburg | wolle-aus-hamburg | wolle@example.org | 1234 |
|
||||
@ -18,6 +19,7 @@ Feature: Notifications for a mentions
|
||||
Big shout to our fellow contributor
|
||||
"""
|
||||
And mention "@matt-rider" in the text
|
||||
And I select a category
|
||||
And I click on "Save"
|
||||
When I log out
|
||||
And I log in with the following credentials:
|
||||
|
||||
@ -83,7 +83,7 @@ export default {
|
||||
update: (store, { data: { CreateComment } }) => {
|
||||
const data = store.readQuery({
|
||||
query: PostQuery(this.$i18n),
|
||||
variables: { slug: this.post.slug },
|
||||
variables: { id: this.post.id },
|
||||
})
|
||||
data.Post[0].comments.push(CreateComment)
|
||||
store.writeQuery({ query: PostQuery(this.$i18n), data })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user