21 Commits

Author SHA1 Message Date
mattwr18
2f43069ea0 Subscribe to notifications/remove polling
- We want to publish when a notification occurs for a specific user, not
  have the client poll the backend for ever user every minute.

- Co-authored-by: @Tirokk <wolle.huss@pjannto.com>
2020-02-05 17:37:38 +01:00
mattwr18
a28eb8c91f Start subscriptions for notifications 2020-01-24 18:23:59 +01:00
mattwr18
760fd01715 Finish refactor of notifications resolver 2019-12-11 11:06:44 +01:00
mattwr18
12236c9324 Convert to transaction function/refactor
- update incorrect variables
2019-12-10 18:09:32 +01:00
roschaefer
3beef5e3fb Reduce database statements in notifications 2019-12-10 18:09:32 +01:00
roschaefer
132c12a7d3 Close neo4j driver sessions
We had this error in our neo4j pod recently:

```
2019-12-02 08:29:42.680+0000 ERROR Unable to schedule bolt session 'bolt-1018230' for execution since there are no available threads to serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s).
2019-12-02 08:29:42.680+0000 ERROR Unable to schedule bolt session 'bolt-1018224' for execution since there are no available threads to serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s).
2019-12-02 08:29:42.681+0000 ERROR Unable to schedule bolt session 'bolt-1018352' for execution since there are no available threads to serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s).
2019-12-02 08:29:42.682+0000 ERROR Unable to schedule bolt session 'bolt-1018243' for execution since there are no available threads to serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s).
```

Apparently the default is 400 threads. So we must have a leak somewhere.
2019-12-02 18:12:11 +01:00
mattwr18
780a418254 Fix lint 2019-11-11 08:52:04 +01:00
roschaefer
8e129c6001 fix: update counter when notification is read
@mattwr18 vue-apollo rocks! Taking the time to study the docs is a
rewarding investment.

My first idea was to cache the `unreadNotificationsCount` with Vuex.
But the docs of apollo even suggest to use apollo's local state as a
complete replacement of Vuex:
https://vue-apollo.netlify.com/guide/local-state.html

Then I further investigated why the updated `NOTIFIED` objects won't
update the notification counter. Turns out: They don't have an ID and
the computed property didn't fire when the notifications array would
change. I fixed both in this commit and yes, it works as expected.

No additional code required 💪
2019-11-11 08:52:04 +01:00
mattwr18
715261238a Protect against cypher injection vulnerability
- following @roschaefer PR review suggestion
2019-11-11 08:52:04 +01:00
mattwr18
f34c8f44e0 Update resolver for paginated notifications 2019-11-11 08:50:35 +01:00
mattwr18
16d7e6c91a Update notifications
- create only one relationship by using merge, but do not update
createdAt attribute/update test
- order by updatedAt_desc
2019-09-13 20:14:47 +02:00
mattwr18
67d68db231 Update post resolver to fix embarrasing bugs
- when a user updates a post, we should not override every property in
our database with the new params, since we have read-only properties
like createdAt that we don't want to go deleting aimlessly.
2019-09-13 20:14:47 +02:00
roschaefer
76acebbb73 Notifications query filters for deleted resources
This should finally fix #1414
2019-09-03 21:28:29 +02:00
roschaefer
cbcba8f08d Follow @Tirokk's suggestion 2019-08-30 16:00:32 +02:00
roschaefer
9b2c707aa3 DRY notifications resolver 2019-08-30 16:00:32 +02:00
roschaefer
3f121c7c4d Refine notification behaviour:
If you mark a post or comment as read even though you already marked the
corresponding notification as read, then you receive `null`.
2019-08-30 16:00:32 +02:00
roschaefer
2846a6a8d3 Spec for notifications passing 2019-08-30 16:00:32 +02:00
roschaefer
cf8ead10f3 Start to refactor backend tests 2019-08-30 16:00:32 +02:00
roschaefer
4b96454b90 Notifications resolver capable of orderBy + filter 2019-08-30 16:00:32 +02:00
roschaefer
643d175ef6 Implement notifications resolver 2019-08-30 16:00:32 +02:00
f78c54a3e8
refactored backend structure 2019-05-31 19:31:39 +02:00