87 Commits

Author SHA1 Message Date
roschaefer
2a544376a3 Delete post.image
In contrast to the other errors, it's better to send `null` for an
image. That way, the browser won't even try to load that url.
2019-09-03 23:19:55 +02:00
roschaefer
64268a1f3c Add locations to seeds, fix shoutedByCurrentUser 2019-09-03 21:28:29 +02:00
roschaefer
00454c874c Remove read-only attributes from posts mutations
For the comments, the fix is not that easy: They are still using
`neo4j-graphql-js` in the resolvers. And that library needs the input
params for the query builder.

See: https://github.com/Human-Connection/Human-Connection/issues/1454
2019-09-03 21:28:29 +02:00
roschaefer
bb3f419532 Refactor graphql queries and fix bug
It's sometimes unbelievable how many bugs you find when doing
refactoring. This time there was some apparent confusion about
`commentsCount` and `commentedCount`. The counters on the post card were
never showing the correct number.
2019-09-03 21:28:29 +02:00
roschaefer
0b3bbb1f14 Delete post.title and obfuscate slug 2019-09-03 21:28:29 +02:00
roschaefer
c4ba2c4aeb SoftDeleteMiddleware obfuscates deleted resources 2019-09-03 21:28:29 +02:00
roschaefer
660e3434aa Implement delete of comments when post is deleted 2019-09-03 21:28:29 +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
roschaefer
bf6e7a8131 Implement fallback resolvers for Post and Comment 2019-08-30 16:00:32 +02:00
Matt Rider
6de602fd58 Revert @roschaefer's hacky fix to Search.feature
- now that we are checking to see if there are any badIds, it was breaking the search functionality
2019-08-26 21:37:36 +02:00
Matt Rider
b990a1055b Fix search functionality
- remove unused line that allows for an empty array of author_not.id_in
2019-08-26 17:51:44 +02:00
roschaefer
9f6757f409 Use guard clauses if possible 2019-08-26 16:53:22 +02:00
Matt Rider
75d984073d Check there are ids in the badIds array
- if there are no ids, we shouldn't add an empty array since it adds unneccessarily to our auto-generated post query and affects greatly performance. see issue #1390
2019-08-26 16:19:42 +02:00
Matt Rider
773779e5f1 Fix UpdatePost resolver/validations 2019-08-23 10:57:11 +02:00
Matt Rider
512bf32b0c Update cypress tests, fix broken comment reactivity 2019-08-20 21:27:00 +02:00
Matt Rider
8735045d11 Update cypress tests, post query 2019-08-20 20:13:29 +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
roschaefer
5103bdbc2a Fix tests 2019-08-13 11:50:33 +02:00
Robert Schäfer
8de0195cf8 Keep existing filter params + same for text search 2019-08-13 11:05:29 +02:00
Robert Schäfer
5fb60d1132 Implement+test blocking a user on backend 2019-08-13 11:05:29 +02:00
Robert Schäfer
963cbbef32 RemovePostEmotions should return deleted object
@mattwr18 I prefer (I believe it's even best practice) that a delete
mutation should return the deleted object. If you run the delete
mutation again, it should return `null` because there is no object like
that anymore. That way the client knows if a delete mutation has changed
any state in the database.

Also I fixed another bug in the resolver. If your graphql mutation looks
like this:

```gql
mutation {
  RemovePostEmotions(to:{ id:"p15"}, data:{emotion: angry}) {
    from {
      id
      name
    }
    to {
      id
      title
    }
    emotion
  }
}
```

Then you get errors because your resolver does not return the name for
the user or the title for the post anymore. Just use spread operator...
and it's fixed.
2019-08-08 23:51:26 +02:00
Robert Schäfer
f3e545a913 Fix bug: Only add emotions for authenticated user 2019-08-08 23:10:01 +02:00
Matt Rider
39a94a8aac Refactor
- follow PR review by @roschaefer
2019-08-07 14:55:32 +02:00
Matt Rider
cb7217f5a7 Fix bug
- apollo query fetchPolicy set to no-cache so that it will refetch a post's emotions count on page transition
2019-08-06 08:05:35 +02:00
Matt Rider
97ff2e9457 Make emotionsArray a const, fix lint 2019-08-05 09:50:25 +02:00
Matt Rider
fb9a632d55 Query a currentUsers emotions for a post, translations 2019-08-01 15:11:41 +02:00
Matt Rider
5423412958 Set up UI 2019-07-31 14:58:05 +02:00
Matt Rider
0a98113c2d Add backend tests for RemovePostEmotions 2019-07-30 13:28:30 +02:00
Matt Rider
3e43539e23 Set up some backend tests for emotions 2019-07-29 17:08:07 +02:00
Matt Rider
16f077fe65 Add authentication tests for AddPostEmotions, emotionsCount 2019-07-16 11:02:43 -03:00
Matt Rider
b034d22732 Fix failing cypress test 2019-07-01 18:50:24 -03:00
Matt Rider
f302961376 Get categories working with UpdatePost, refactor 2019-07-01 18:00:55 -03:00
Matt Rider
865e2c0ec3 Refactor resolver, rename params
- Use one cypher statement

Co-authored-by: Tirokk <wolle.huss@pjannto.com>
2019-06-28 10:17:22 -03:00
Matt Rider
351f258fab Refactor resolver, write component tests
- use UNWIND instead of iterating over categories(cypher magic)
- do not return nested categories on post creation as it's expensive and we don't use
- refactor backend test
- component tests for CategoriesSelect
2019-06-27 16:57:55 -03:00
Matt Rider
07576d084c Get categories working with CreatePost 2019-06-26 15:59:57 -03:00
Matt Rider
d714927315 Set up backend for Post creation with categories 2019-06-26 11:26:44 -03:00
f78c54a3e8
refactored backend structure 2019-05-31 19:31:39 +02:00