30 Commits

Author SHA1 Message Date
mattwr18
dfd30cbaac Remove check for setting name to null or undefined
- this was making things more likely to fail from the frontend, we would
need to consider doing a db manipulation for users from the old alpha
who have user.name as null.
- it only protects against someone who bypasses our UI and sends a
message directly to the backend, but if they can do that we have bigger
problems.
2019-12-13 10:17:19 +01:00
mattwr18
d375ebe7d9 Write test/refactor tests/resolvers/middleware
- write tests for userMiddleware
- checks the functionality of nodes/locations middleware
- refactor to not allow users to update to remove their name
  debatable whether we want that or not, but we do not allow users to
create accounts with no name, so we should be consistent, before we were
using neode to validate this, but we have are removing neode from
production code, so we must validate ourselves
- collate UpdateUser mutations to one
2019-12-12 18:14:47 +01:00
mattwr18
3e15ecdfa2 Refactor tests, extract validation to middleware 2019-12-12 14:25:28 +01:00
mattwr18
c871ec2632 Refactor validationMiddleware 2019-12-11 16:29:20 +01:00
mattwr18
da150e0b27 Refactor notificationsMiddleware
- Use transaction functions
- extract validations into validationsMiddleware
- break notifyUsers into notifyUsersOfMention/notifyUsersOfComment
2019-12-06 14:48:32 +01:00
mattwr18
5117a97b1c Use readTransaction for non-write transactions 2019-12-05 13:17:26 +01:00
mattwr18
085b59bf4d Merge branch 'master' of github.com:Human-Connection/Human-Connection into 1710-list-and-protocol-moderation 2019-12-04 13:23:06 +01:00
mattwr18
b3640659bb Add missing unit tests/refactor code
- Refactoring without tests makes it riskier
- Move some tests from resolver to middleware unit tests to live closer
to where the validation happens, remove duplicate tests
- DRY out code
2019-12-03 17:59:59 +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
c05065f684 Refactor backend
- update script
- use readTxResult for validateReview
- favor more verbose variables
- do not set review.closed as we close the report and the rule at the
moment is set to 'latestReviewUpdatedAtRules' rule, so it's clear the
last review must have been the one that closed the report
2019-12-02 13:38:35 +01:00
mattwr18
f5545e3976 Fix middleware/spec 2019-11-29 19:45:34 +01:00
mattwr18
5d63dda6ee Refactor validateReport/Review
- Don't throw error if a report already exists since we use MERGE and
that does not create a new resource if it exists. That is tested at the
neo4j(database) level.
- We also have a test to make in reports.spec.js that no duplicate is
created to ensure we didn't make some error on our part.
- Fix some faulty logic in validateReview
2019-11-29 18:47:41 +01:00
mattwr18
2f249a73c5 Rename REPORTED Claim to FILED Report 2019-11-26 15:35:48 +01:00
Wolfgang Huß
99af6cbf8a Implement displaying multiple claims in the frontend 2019-11-22 18:40:51 +01:00
Wolfgang Huß
9a7774ce86 Implement review validation with validateReview 2019-11-22 15:19:49 +01:00
Wolfgang Huß
526e4c642b Merge branch 'master' of github.com:Human-Connection/Human-Connection into 1710-list-and-protocol-moderation 2019-11-08 08:28:47 +01:00
Youri Seichter
d262ed678c close all open sessions 2019-11-06 18:32:25 +01:00
Wolfgang Huß
21e82d2ea5 Get decide mutation to work
- Tests are not fully working yet!
2019-10-30 19:07:51 +01:00
Wolfgang Huß
7b3224327e Prepare backend for next implementation step 2019-10-30 13:51:00 +01:00
mattwr18
e8c6941142 Follow @roschaefer's PR review suggestions
- disable button if form.reasonCategory is falsy
- extract valuesReasonCategoryOptions to global constant
- extract reasonCategoryOptions to created lifecycle hook to keep data()
clean and use map
- extract formSchema to components/utils and test
- remove validator from formSchema and validate based on "Deep Rules" https://github.com/yiminghe/async-validator#deep-rules
- Use v-model to update reasonCategory and reasonDescription
- default to error message in English from backend
- Update template slot to use new syntax
2019-10-15 20:28:25 +02:00
mattwr18
faf0a15aee Update to use enum in tests, seed data, etc, refactor resolver
- Extract validations to the validations middleware to clean it up
- Remove resourceId since it throws an error in the mutation if the user
asks for it back, and the resourceId is returned in post/comment/user.id
- use writeTxResultPromise to benefit from automatic retries
- more descriptive variable naming
- extract cypher query to make db manipulation into script so that it
can be run from the command line, at least locally.
2019-10-14 21:07:55 +02:00
roschaefer
1b5d91bfd2 Refactor post spec, implement soft delete, fix bug
I think the validation for categories was too complex and the graphql
query 'PostEmotionsByCurrentUser' was erroneously allowed for
unauthenticated users.
2019-09-03 21:28:29 +02:00
Matt Rider
abbfc6d757 Remove commented out, unneeded code 2019-08-23 11:30:20 +02:00
Matt Rider
773779e5f1 Fix UpdatePost resolver/validations 2019-08-23 10:57:11 +02:00
Matt Rider
555c5254bc Add tests, validations for too many categories
- Co-authored-by: Joseph Ngugi <jngugi88@gmail.com>
2019-08-19 17:31:55 +02:00
kachulio1
314dfcf413 Throw error if no categories on post creation
Co-authored-by: mattwr18 <mattwr18@gmail.com>
2019-08-15 17:55:02 +03:00
Alina Beck
0439b4407b remove social media validations from middleware 2019-07-29 17:16:05 +02:00
Matt Rider
1c53c58f42 Add backend validation tests to expose non-validation
- remove validation/index.js as it's not being used
- move validations to validationMiddleware.js where it validates
2019-07-16 14:54:13 -03:00
Matt Rider
ba7e44a762 Refactor CreateComment resolver
- extract out the validations for a valid comment
2019-07-12 08:07:07 -03:00
Robert Schäfer
10ae4abaae Use neode to bring User mutations under control
This commit takes all backend changes for signup and invite feature. I
was working on these features and removed the generated mutations for
type user along the way.
2019-07-03 15:58:42 +02:00