254 Commits

Author SHA1 Message Date
mattwr18
6d2d4f305f
Merge branch 'master' into 37-full-text-search-top-bar 2019-03-07 21:08:20 -03:00
Grzegorz Leoniec
fcb51e4eda
Merge remote-tracking branch 'origin/master' into 37-full-text-search-top-bar 2019-03-06 18:49:34 +01:00
Robert Schäfer
389f447186
Merge branch 'master' into 27_disable_posts 2019-03-06 17:21:56 +01:00
Robert Schäfer
8072939458 Tiny performance improvement 2019-03-06 17:21:49 +01:00
Robert Schäfer
f40a67b7a8 Implement disabling of comments+users+posts 2019-03-06 17:13:36 +01:00
Robert Schäfer
1c34f10f96 Test refactoring: Check comments + posts 2019-03-06 17:13:36 +01:00
Grzegorz Leoniec
2813de4f8b
Fixed organization seeder 2019-03-06 13:20:33 +01:00
Robert Schäfer
5cff508bd6 Disable/enable fullfills tests 2019-03-06 01:07:04 +01:00
Robert Schäfer
0a73ddd46d Refactor: custom resolvers for moderation 2019-03-05 23:59:54 +01:00
Robert Schäfer
2b7576521c Fix lint
+ return more attributes in post factory for convenience
2019-03-05 18:17:02 +01:00
Robert Schäfer
592f25b978 Implement update of .disabled field 2019-03-05 18:14:25 +01:00
Robert Schäfer
99cebc8d64 Implementation ready except disabled attr. 2019-03-05 17:45:10 +01:00
Robert Schäfer
f2e7e515a4 Check from: User! matches the authenticated user 2019-03-05 16:46:39 +01:00
Robert Schäfer
85d9d7043e Setup isModerator permission for disable relation 2019-03-05 16:25:01 +01:00
Robert Schäfer
420ea8a4d6 Scaffold some tests for disabledBy relation 2019-03-05 16:15:31 +01:00
Robert Schäfer
f644507e4f Intermediate commit 2019-03-05 15:47:03 +01:00
Robert Schäfer
180491c08c Put isAuthor in permissions middleware
I find it dirty to access the database in a middleware, ie. I would like
to put all access on the database as close to the resolver as possible.
However, in this case that would mean to put the authorization check in
the resolver, where nobody expects it to be.

CC @appinteractive
2019-03-04 19:43:24 +01:00
Robert Schäfer
b64ea75011 Add a deleted post and a disabled post to seeds 2019-03-04 18:41:05 +01:00
Robert Schäfer
c869724d29 Let all tests pass 💚 2019-03-04 18:41:05 +01:00
Robert Schäfer
b2520258a3 Improve specification of posts resolver
* only authors are alllowed to update/delete their own posts
* set disabled+deleted to false if not provided
2019-03-04 18:41:05 +01:00
Grzegorz Leoniec
adcedb264f
Merge branch 'master' into 37-full-text-search-top-bar 2019-03-04 15:56:32 +01:00
Robert Schäfer
4a64755df7
Merge branch 'master' into 27_disable_posts 2019-03-03 15:27:27 +01:00
Robert Schäfer
8d1eb6026a Let all tests pass 💚 2019-03-03 14:35:08 +01:00
Robert Schäfer
fb2b407be0 Extend @Tirokk 's test to Create and Update 2019-03-03 14:32:29 +01:00
Robert Schäfer
f25708875a Refactor badges test
CC @Tirokk @grenzfrequence

* the top level block should correspond with the name of the resolver
  * the block below should be `CreatePost` or `UpdatePost`
* the arguments of client.request are `query/mutation`, `variables` but
  you passed in the `headers` which should go into `new
  GraphQlClient(host, options)`
* re-use the very same mutation to avoid bugs in the tests
* use `await expect(someAsyncMethod).resolves.toEqual(expected)` style for
  extra test assurance
2019-03-03 14:01:50 +01:00
Wolfgang Huß
6937c60ef8 Only admins are allowed to create badges 2019-03-01 15:49:11 +01:00
Matt Rider
5e592f666b Write unit test badge creation
- for unauthenticated
- for authenticated admin

Co-authored-by: Wolfgang Huss <wolle.huss@pjannto.com>
2019-02-28 16:16:14 -03:00
Robert Schäfer
7700a34804 Merge remote-tracking branch 'origin/master' into 37-full-text-search-top-bar 2019-02-28 18:55:31 +01:00
Robert Schäfer
8febf147ce Fix lint 2019-02-28 18:37:52 +01:00
Robert Schäfer
f3ab671f21 Soft delete middleware test passes 2019-02-28 18:37:52 +01:00
Robert Schäfer
911500a3bd Don't override given { deleted, disabled } = args
@appinteractive I guess this was done unintentionally?
2019-02-28 18:37:52 +01:00
Robert Schäfer
738ba4f51c DRY softDeleteMiddleware 2019-02-28 18:37:52 +01:00
Robert Schäfer
ce28de893b Write a test for #27
Moderators are allowed to see disabled or deleted posts if they
ask for it.
2019-02-28 18:37:52 +01:00
Matt Rider
8f382bc166 Merge branch '37-full-text-search-top-bar' of github.com:Human-Connection/Nitro-Backend into 37-full-text-search-top-bar 2019-02-27 19:34:53 -03:00
Matt Rider
671a713410 Merge branch 'master' of github.com:Human-Connection/Nitro-Backend into 37-full-text-search-top-bar 2019-02-27 19:24:41 -03:00
Grzegorz Leoniec
6a146aa699 Improved search query 2019-02-27 19:02:26 -03:00
Grzegorz Leoniec
360acdb141 Fix search 2019-02-27 19:02:26 -03:00
Robert Schäfer
63845681b7 Fix lint 2019-02-27 19:02:26 -03:00
Robert Schäfer
5a995f9f86 Implement test for search
@appinteractive could you have a look if sanitization of search queries
work? I created a test and I see "unterminated string" exceptions. This
is not what we want! All user input should be escaped.
2019-02-27 19:01:23 -03:00
Robert Schäfer
5230099e6b Sketch a test 2019-02-27 18:56:23 -03:00
Robert Schäfer
46436ca9b1 Setup a routine how to create indices initially
In order to create the indices programmatically we need to change the
default password for security concerns. To create the user we need to
start the neo4j database. So I decided to provide a bash script that
let us do it once the container are started.

In production we must change the NEO4J_PASSWORD.
2019-02-27 18:56:23 -03:00
Grzegorz Leoniec
832a778ca1 Added findPost query 2019-02-27 18:53:27 -03:00
Matt Rider
f9b60fa0b0 Fix lint 2019-02-27 08:10:20 -03:00
Robert Schäfer
5fd44230dd Get rid of LoggedInUser graphql type
This was causing a lot of headache on the frontend. Now, there a single
source of truth. If you query `currentUser` you can overwrite your local
copy of the user and update the UI.
2019-02-27 11:08:13 +01:00
Robert Schäfer
69bf53e05e Impplement currentUser query
* remove dead code (passport-jwt)
* refactor resolves to have a separate folder
* currentUser and login have the same response
2019-02-26 16:35:31 +01:00
Robert Schäfer
c4f15e626d Fix lint and unblock port 4001
We have to specify the `yarn run test:cypress` in `.travis.yml` in the
Nitro-Web repo.
2019-02-26 00:46:14 +01:00
Robert Schäfer
ec2b1050bc Less redundancy and more consistency in factories
* use the same `relate` method for now
* use a capital letter for the model `user` instead of `User`
2019-02-25 21:28:30 +01:00
Robert Schäfer
c86658729e Merge remote-tracking branch 'origin/master' into editor 2019-02-22 18:05:42 +01:00
Robert Schäfer
2e7e0579e4 Fix bug with id middleware
Ids are queried only for well known queries and mutations
2019-02-22 16:11:07 +01:00
Robert Schäfer
889818cd2d Expose bug in Query { isLoggedin }
The idMiddleware was adding selection fields to the resolveInfo even if
the selection fields were empty. This caused a bug for each resolve
function including

```
{
 isLoggedin
}
```

which does not have any additional curly braces after the query.
2019-02-22 15:21:23 +01:00