diff --git a/backend/src/db/seed.js b/backend/src/db/seed.js
index ba6352770..bb9243f90 100644
--- a/backend/src/db/seed.js
+++ b/backend/src/db/seed.js
@@ -746,31 +746,31 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
])
// notify first report filers
await Promise.all([
- reportAgainstDagobert.relateTo(jennyRostock, 'notified', {
+ jennyRostock.relateTo(reportAgainstDagobert, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
- reportAgainstHuey.relateTo(jennyRostock, 'notified', {
+ jennyRostock.relateTo(reportAgainstHuey, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
- reportAgainstTrollingPostP2.relateTo(jennyRostock, 'notified', {
+ jennyRostock.relateTo(reportAgainstTrollingPostP2, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
- reportAgainstTrollingPostP9.relateTo(jennyRostock, 'notified', {
+ jennyRostock.relateTo(reportAgainstTrollingPostP9, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
- reportAgainstTrollingCommentC1.relateTo(huey, 'notified', {
+ huey.relateTo(reportAgainstTrollingCommentC1, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
- reportAgainstTrollingCommentC2.relateTo(jennyRostock, 'notified', {
+ jennyRostock.relateTo(reportAgainstTrollingCommentC2, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
- reportAgainstDewey.relateTo(dagobert, 'notified', {
+ dagobert.relateTo(reportAgainstDewey, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
@@ -801,15 +801,15 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
])
// notify second report filers
await Promise.all([
- reportAgainstDagobert.relateTo(louie, 'notified', {
+ louie.relateTo(reportAgainstDagobert, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
- reportAgainstTrollingPostP2.relateTo(peterLustig, 'notified', {
+ peterLustig.relateTo(reportAgainstTrollingPostP2, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
- reportAgainstTrollingCommentC1.relateTo(bobDerBaumeister, 'notified', {
+ bobDerBaumeister.relateTo(reportAgainstTrollingCommentC1, 'notified', {
read: false,
reason: 'filed_report_on_resource',
}),
diff --git a/backend/src/models/Comment.js b/backend/src/models/Comment.js
index bffd2922b..8d9f8b1cb 100644
--- a/backend/src/models/Comment.js
+++ b/backend/src/models/Comment.js
@@ -25,34 +25,4 @@ export default {
target: 'User',
direction: 'in',
},
- notified: {
- type: 'relationship',
- relationship: 'NOTIFIED',
- target: 'User',
- direction: 'out',
- properties: {
- createdAt: {
- type: 'string',
- isoDate: true,
- required: true,
- default: () => new Date().toISOString(),
- },
- updatedAt: {
- type: 'string',
- isoDate: true,
- required: true,
- default: () => new Date().toISOString(),
- },
- read: { type: 'boolean', default: false },
- reason: {
- type: 'string',
- valid: [
- 'mentioned_in_post',
- 'mentioned_in_comment',
- 'commented_on_post',
- 'filed_report_on_resource',
- ],
- },
- },
- },
}
diff --git a/backend/src/models/Post.js b/backend/src/models/Post.js
index 758a0220c..07b2560f3 100644
--- a/backend/src/models/Post.js
+++ b/backend/src/models/Post.js
@@ -17,31 +17,6 @@ export default {
image: { type: 'string', allow: [null] },
deleted: { type: 'boolean', default: false },
disabled: { type: 'boolean', default: false },
- notified: {
- type: 'relationship',
- relationship: 'NOTIFIED',
- target: 'User',
- direction: 'out',
- properties: {
- createdAt: {
- type: 'string',
- isoDate: true,
- required: true,
- default: () => new Date().toISOString(),
- },
- updatedAt: {
- type: 'string',
- isoDate: true,
- required: true,
- default: () => new Date().toISOString(),
- },
- read: { type: 'boolean', default: false },
- reason: {
- type: 'string',
- valid: ['mentioned_in_post', 'mentioned_in_comment', 'commented_on_post'],
- },
- },
- },
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
updatedAt: {
type: 'string',
diff --git a/backend/src/models/Report.js b/backend/src/models/Report.js
index f54882398..d2f69c602 100644
--- a/backend/src/models/Report.js
+++ b/backend/src/models/Report.js
@@ -49,34 +49,4 @@ export default {
closed: { type: 'boolean', default: false },
},
},
- notified: {
- type: 'relationship',
- relationship: 'NOTIFIED',
- target: 'User',
- direction: 'out',
- properties: {
- createdAt: {
- type: 'string',
- isoDate: true,
- required: true,
- default: () => new Date().toISOString(),
- },
- updatedAt: {
- type: 'string',
- isoDate: true,
- required: true,
- default: () => new Date().toISOString(),
- },
- read: { type: 'boolean', default: false },
- reason: {
- type: 'string',
- valid: [
- 'mentioned_in_post',
- 'mentioned_in_comment',
- 'commented_on_post',
- 'filed_report_on_resource',
- ],
- },
- },
- },
}
diff --git a/backend/src/models/User.js b/backend/src/models/User.js
index 055cbfc83..890c3e7ff 100644
--- a/backend/src/models/User.js
+++ b/backend/src/models/User.js
@@ -90,11 +90,35 @@ export default {
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() },
},
},
- notifications: {
+ notified: {
type: 'relationship',
relationship: 'NOTIFIED',
- target: 'User',
+ target: ['Post', 'Comment'],
direction: 'in',
+ properties: {
+ createdAt: {
+ type: 'string',
+ isoDate: true,
+ required: true,
+ default: () => new Date().toISOString(),
+ },
+ updatedAt: {
+ type: 'string',
+ isoDate: true,
+ required: true,
+ default: () => new Date().toISOString(),
+ },
+ read: { type: 'boolean', default: false },
+ reason: {
+ type: 'string',
+ valid: [
+ 'mentioned_in_post',
+ 'mentioned_in_comment',
+ 'commented_on_post',
+ 'filed_report_on_resource',
+ ],
+ },
+ },
},
termsAndConditionsAgreedVersion: {
type: 'string',
diff --git a/backend/src/schema/resolvers/notifications.spec.js b/backend/src/schema/resolvers/notifications.spec.js
index 3c389dce1..7e8d7bf6f 100644
--- a/backend/src/schema/resolvers/notifications.spec.js
+++ b/backend/src/schema/resolvers/notifications.spec.js
@@ -28,7 +28,7 @@ beforeAll(() => {
beforeEach(async () => {
authenticatedUser = null
- variables = { orderBy: 'createdAt_asc' }
+ variables = { orderBy: 'updatedAt_desc' }
})
afterEach(async () => {
@@ -94,37 +94,37 @@ describe('given some notifications', () => {
}),
])
await Promise.all([
- post1.relateTo(neighbor, 'notified', {
+ neighbor.relateTo(post1, 'notified', {
createdAt: '2019-08-29T17:33:48.651Z',
updatedAt: '2019-08-29T17:33:48.651Z',
read: false,
reason: 'mentioned_in_post',
}),
- post2.relateTo(user, 'notified', {
+ user.relateTo(post2, 'notified', {
createdAt: '2019-08-30T17:33:48.651Z',
updatedAt: '2019-08-30T17:33:48.651Z',
read: true,
reason: 'mentioned_in_post',
}),
- post3.relateTo(user, 'notified', {
+ user.relateTo(post3, 'notified', {
createdAt: '2019-08-31T17:33:48.651Z',
updatedAt: '2019-08-31T17:33:48.651Z',
read: false,
reason: 'mentioned_in_post',
}),
- comment1.relateTo(user, 'notified', {
+ user.relateTo(comment1, 'notified', {
createdAt: '2019-08-30T15:33:48.651Z',
updatedAt: '2019-08-30T15:33:48.651Z',
read: true,
reason: 'mentioned_in_comment',
}),
- comment2.relateTo(user, 'notified', {
+ user.relateTo(comment2, 'notified', {
createdAt: '2019-08-30T19:33:48.651Z',
updatedAt: '2019-08-30T19:33:48.651Z',
read: false,
reason: 'mentioned_in_comment',
}),
- comment3.relateTo(neighbor, 'notified', {
+ neighbor.relateTo(comment3, 'notified', {
createdAt: '2019-09-01T17:33:48.651Z',
updatedAt: '2019-09-01T17:33:48.651Z',
read: false,
@@ -165,19 +165,19 @@ describe('given some notifications', () => {
reportOnComment.relateTo(comment4, 'belongsTo'),
])
await Promise.all([
- reportOnUser.relateTo(user, 'notified', {
+ user.relateTo(reportOnUser, 'notified', {
createdAt: '2020-01-15T16:33:48.651Z',
updatedAt: '2020-01-15T16:33:48.651Z',
read: false,
reason: 'filed_report_on_resource',
}),
- reportOnPost.relateTo(user, 'notified', {
+ user.relateTo(reportOnPost, 'notified', {
createdAt: '2020-01-16T10:33:48.651Z',
updatedAt: '2020-01-16T10:33:48.651Z',
read: true,
reason: 'filed_report_on_resource',
}),
- reportOnComment.relateTo(user, 'notified', {
+ user.relateTo(reportOnComment, 'notified', {
createdAt: '2020-01-14T12:33:48.651Z',
updatedAt: '2020-01-14T12:33:48.651Z',
read: false,
@@ -245,7 +245,7 @@ describe('given some notifications', () => {
it('returns all notifications of current user', async () => {
const expected = {
data: {
- notifications: expect.arrayContaining([
+ notifications: [
{
createdAt: '2020-01-16T10:33:48.651Z',
updatedAt: '2020-01-16T10:33:48.651Z',
@@ -348,7 +348,7 @@ describe('given some notifications', () => {
content: 'You have seen this comment mentioning already',
},
}),
- ]),
+ ],
},
errors: undefined,
}
@@ -363,27 +363,7 @@ describe('given some notifications', () => {
it('returns only unread notifications of current user', async () => {
const expected = {
data: {
- notifications: expect.arrayContaining([
- {
- createdAt: '2019-08-30T19:33:48.651Z',
- updatedAt: '2019-08-30T19:33:48.651Z',
- read: false,
- reason: 'mentioned_in_comment',
- from: {
- __typename: 'Comment',
- content: 'You have been mentioned in a comment',
- },
- },
- {
- createdAt: '2019-08-31T17:33:48.651Z',
- updatedAt: '2019-08-31T17:33:48.651Z',
- read: false,
- reason: 'mentioned_in_post',
- from: {
- __typename: 'Post',
- content: 'You have been mentioned in a post',
- },
- },
+ notifications: [
{
createdAt: '2020-01-15T16:33:48.651Z',
updatedAt: '2020-01-15T16:33:48.651Z',
@@ -427,7 +407,27 @@ describe('given some notifications', () => {
],
},
},
- ]),
+ {
+ createdAt: '2019-08-31T17:33:48.651Z',
+ updatedAt: '2019-08-31T17:33:48.651Z',
+ read: false,
+ reason: 'mentioned_in_post',
+ from: {
+ __typename: 'Post',
+ content: 'You have been mentioned in a post',
+ },
+ },
+ {
+ createdAt: '2019-08-30T19:33:48.651Z',
+ updatedAt: '2019-08-30T19:33:48.651Z',
+ read: false,
+ reason: 'mentioned_in_comment',
+ from: {
+ __typename: 'Comment',
+ content: 'You have been mentioned in a comment',
+ },
+ },
+ ],
},
errors: undefined,
}
diff --git a/backend/src/schema/resolvers/reports.js b/backend/src/schema/resolvers/reports.js
index b0921505d..f6cfd8f0d 100644
--- a/backend/src/schema/resolvers/reports.js
+++ b/backend/src/schema/resolvers/reports.js
@@ -186,9 +186,5 @@ export default {
},
FILED: {
...undefinedToNullResolver(['reasonDescription']),
- // Wolle reasonDescription: async (parent, _params, _context, _resolveInfo) => {
- // if (typeof parent.reasonDescription !== 'undefined') return parent.reasonDescription
- // return null
- // },
},
}
diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js
index ee7e53dfd..68b3d8e6c 100644
--- a/cypress/integration/common/steps.js
+++ b/cypress/integration/common/steps.js
@@ -383,7 +383,7 @@ When("I log in with the following credentials:", table => {
When("open the notification menu and click on the first item", () => {
cy.get(".notifications-menu").invoke('show').click(); // "invoke('show')" because of the delay for show the menu
- cy.get('[data-testid="notification-link"]')
+ cy.get('.notification .notifications-card')
.first()
.click({
force: true
diff --git a/webapp/components/Notification/Notification.vue b/webapp/components/Notification/Notification.vue
index 8b2b41e4d..9ee3512e9 100644
--- a/webapp/components/Notification/Notification.vue
+++ b/webapp/components/Notification/Notification.vue
@@ -27,8 +27,6 @@
diff --git a/webapp/components/NotificationList/NotificationList.spec.js b/webapp/components/NotificationList/NotificationList.spec.js
index 047db3d7d..35625ecba 100644
--- a/webapp/components/NotificationList/NotificationList.spec.js
+++ b/webapp/components/NotificationList/NotificationList.spec.js
@@ -73,12 +73,10 @@ describe('NotificationList.vue', () => {
describe('click on a notification', () => {
beforeEach(() => {
- // Wolle wrapper.find('.notification-link-for-test').trigger('click')
- wrapper.getByTestId('notification-link').trigger('click')
- expect(wrapper.attributes('id')).toBe('foo')
+ wrapper.find('.notification .notifications-card').trigger('click')
})
- it.only("emits 'markAsRead' with the id of the notification source", () => {
+ it("emits 'markAsRead' with the id of the notification source", () => {
expect(wrapper.emitted('markAsRead')[0]).toEqual(['post-1'])
})
})