1022 Commits

Author SHA1 Message Date
mattwr18
f876021ec6 Fix: User.name is not non-nullable 2019-12-13 17:48:19 +01:00
mattwr18
307076771c Fix lint 2019-12-13 10:45:58 +01:00
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
8a93e402b9 Remove neode update from production code
- Favor transaction functions we have more control over
2019-12-12 14:24:43 +01:00
mattwr18
6903a6cc71 Favor transaction functions even for seeds 2019-12-11 19:38:39 +01:00
mattwr18
53791c83e8 Favor transaction functions in login mutation 2019-12-11 19:31:50 +01:00
mattwr18
d38131e24a Refactor to use transaction functions/logging 2019-12-11 19:27:37 +01:00
mattwr18
6ef9ca3343 Refactor to use readTransaction 2019-12-11 19:09:38 +01:00
mattwr18
1e85cbb6a2 Refactor shout/unshout mutations
- Remove unrecommended auto-commit transactions from code base
- Favor transaction functions
2019-12-11 19:01:29 +01:00
mattwr18
18ab7186f5 Favor transaction functions over auto-commit 2019-12-11 18:53:08 +01:00
mattwr18
b1c5c4dbf9 Avoid testing third-party code
- This test, though I understand why it was added, is not necessary in
my opinion. It's more difficult to get this test to pass since we don't
call session.run, we call session.writeTransaction which has a callback
that calls transaction.run...
- I think we don't need to test that our third party library does what
it was added to do... they have their own tests, which can be found here
@roschaefer, which I think are sufficient https://github.com/validatorjs/validator.js/blob/master/test/sanitizers.js
- We can always add another type of test, if you feel necessary, maybe
an e2e?
2019-12-11 18:44:01 +01:00
mattwr18
3c6932e21a Update passwordReset resolver/spec 2019-12-11 18:43:36 +01:00
mattwr18
d39e702e70 Update exisitingEmailAddress 2019-12-11 18:19:40 +01:00
mattwr18
b583b02fb4 Update createPasswordReset helper function
- the test is broken, can you have a look @roschaefer??
- I tried to get it to work, but it's complicated with multiple
promises... I'm ok if we remove this test as well as it's only testing
that normalizeEmail works as it's supposed to... but that hopefully is
tested on the side of the validator library
2019-12-11 17:57:25 +01:00
mattwr18
c871ec2632 Refactor validationMiddleware 2019-12-11 16:29:20 +01:00
mattwr18
cc0a33ec7d Use transaction function in isUniqueFor 2019-12-11 13:26:18 +01:00
mattwr18
73a5b394d6 Refactor isAuthor to use transaction function 2019-12-11 12:56:49 +01:00
mattwr18
ca9c58c06b Add errors undefined to tests
- helps with debugging
2019-12-11 12:50:46 +01:00
mattwr18
760fd01715 Finish refactor of notifications resolver 2019-12-11 11:06:44 +01:00
mattwr18
79d23cc6de Merge branch 'master' of github.com:Human-Connection/Human-Connection into 2412-favor-transaction-function 2019-12-11 10:56:42 +01:00
roschaefer
cc7cd6b8b0 Fix backend tests 2019-12-10 18:13:34 +01:00
mattwr18
4f0df2f28f Remove disable from query request
- we removed it, prevent null pointer error
2019-12-10 18:09:32 +01:00
mattwr18
0a50a02f88 Follow @roschaefer suggestion/remove guard clauses 2019-12-10 18:09:32 +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
b2ccc1b61e Better debugging 2019-12-10 18:09:32 +01:00
mattwr18
4af63ee0aa
Merge pull request #2404 from Human-Connection/get_rid_of_inconsistency_with_setup_neode
Get rid of inconsistency with neode setup
2019-12-10 11:04:35 +01:00
roschaefer
5271337b49 Reduce the number of database calls even more 2019-12-09 18:49:27 +01:00
mattwr18
79c6bd5c20 Paginate moderations page without losing filtering
Co-authored-by: Tirokk <wolle.huss@pjannto.com>
2019-12-09 16:37:04 +01:00
mattwr18
3bc944b06d Finish refactoring posts resolver 2019-12-06 18:56:20 +01:00
mattwr18
6ed435364c Start updating posts resolver 2019-12-06 18:29:50 +01:00
mattwr18
6f4ee5f3b7 Refactor resolver/spec
- favor transaction functions
- add errors undefined, clean up specs
2019-12-06 17:48:34 +01:00
mattwr18
0e757cf94f Refactor to fix test, DRY out code 2019-12-06 17:48:14 +01:00
mattwr18
a1acd48821 Use verbose variables 2019-12-06 14:56:14 +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
132951c525 Update handleContentDataOfPost to return post
- fix tests, functionality
2019-12-06 13:03:05 +01:00
Robert Schäfer
a3251710fa
Update backend/src/schema/resolvers/users/blockedUsers.spec.js
Co-Authored-By: mattwr18 <mattwr18@gmail.com>
2019-12-06 12:34:33 +01:00
Robert Schäfer
df22f2a5b4
Update backend/src/middleware/hashtags/hashtagsMiddleware.spec.js
Co-Authored-By: mattwr18 <mattwr18@gmail.com>
2019-12-06 12:34:24 +01:00
roschaefer
fdca5b008b Return empty array instead null for "not reviewed"
@mattwr18 why did you add the null check in th resolver?
2019-12-06 02:47:14 +01:00
roschaefer
2f2bf571ed Eliminate database calls for filed and reviewed
I learned map projections and list comprehensions in cypher tonight!
🎉 So much wow!
2019-12-06 01:57:49 +01:00
mattwr18
4d0df181b6
Merge pull request #2432 from Human-Connection/remove-query-for-disable-property-for-reports
Remove disable from reports.disable Query
2019-12-05 21:14:55 +01:00
mattwr18
9fd4ad47dd
Merge pull request #2317 from Human-Connection/2253-fix-scroll-layout-issue
2253 fix scroll layout issue
2019-12-05 21:02:10 +01:00
roschaefer
8f0ce19f09 Implement getDriver() and getNeode() the same way
I want to introduce `neode` and `neo4j-graphql-js` to my students and
saw this.
2019-12-05 21:00:24 +01:00
Robert Schäfer
b7be0f100b
Merge pull request #2424 from Human-Connection/update-test-description
Update test description
2019-12-05 20:55:59 +01:00
mattwr18
1827889582 Refactor notificationsMiddleware/locations
- start refactoring
- locations does not have any automated tests, which makes it more
difficult to refactor and have confidence that functionality will not be
broken
- notificationsMiddleware in progress
2019-12-05 20:42:45 +01:00
mattwr18
55f25b153c Remove disable from models/Report.js
- we are not setting this property, and it's inclusion in this model
with a default false value meant that there were no errors with seeded
data, but with the data returned from the db_manipulation there was.
2019-12-05 20:31:19 +01:00
mattwr18
de64f1dd4a Refactor hashtagsMiddleware updateHashtagsOfPost
- Favor transaction functions for production environment
- Use one transaction instead of two as we can use optional match to
delete potential previous relationships
2019-12-05 13:43:55 +01:00
mattwr18
f2743c992f Use transaction function jwt/decode 2019-12-05 13:18:06 +01:00