70 Commits

Author SHA1 Message Date
Wolfgang Huß
7620d9b4da Fix linting to this new prettier 2021-07-20 18:30:43 +02:00
cba299827d
lint fixes backend 2021-04-12 13:24:52 +02:00
99e75066f9
fixed backend unit tests 2021-04-12 13:24:52 +02:00
Moriz Wahl
250d231a74
auto detect language. Input field in contribution form removed. 2021-01-21 13:30:56 +01:00
Robert Schäfer
512ef672bf
feat: Introduce graphql image type (#3043)
* refactor(graphql): Introduce image type

* Undo changes to .travis.yml

* chore: Upgrade travis to node LTS

- URL is available since v10

* chore: use lts

Co-authored-by: mattwr18 <mattwr18@gmail.com>
2020-03-16 15:32:19 +01:00
roschaefer
fa0e64b7cb Merge remote-tracking branch 'origin/master' into refactor_factories_with_rosie
There was a single step definition that created a post and a comment. I
would say let's put that in two different steps.
2020-02-01 13:33:07 +01:00
roschaefer
fc367297e3 Get rid of different factory files
..and fix some cypress tests
2020-01-28 23:12:50 +01:00
roschaefer
2fc71d75a5 Refactor factory for comments 2020-01-28 22:43:27 +01:00
roschaefer
95bfb090fd Refactor factory for posts 2020-01-28 22:43:26 +01:00
roschaefer
2a79c53765 Refactor user factory 2020-01-28 22:43:26 +01:00
mattwr18
f8f62cc71f Merge branch 'master' of github.com:Human-Connection/Human-Connection into neo4j_data_migrations 2020-01-23 20:42:44 +01:00
Mike Aono
d49afc25cf test(cypress): Cover "Pinned post" feature
* Implement cypress tests

- Start implementation of cypress tests for pinned posts

* Test that Admin can pin a post

- Tests the process of an admin pinning a post

* Resolve failing tests

- Fix ordering of posts immediately after pinning posts by reloading page
- Check that tests are pinned posts are displayed first for role user

* Refactor to seperate the initialization

- Of the post data created in the database during setup

* Fix toaster test

* test(cypress): Add missing parts for pin feature

* docs(cucumber): Link to admin 🥒 folder

* Follow @mattwr18's suggestions

* test(backend): Order pinned posts like frontend

@mattwr18 I think this was a false negative.

Co-authored-by: Robert Schäfer <git@roschaefer.de>
2020-01-23 20:30:12 +01:00
roschaefer
b063847849 refactor: Make db:setup init stage of migrate 2020-01-20 11:00:52 +01:00
mattwr18
ca9c58c06b Add errors undefined to tests
- helps with debugging
2019-12-11 12:50:46 +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
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
Robert Schäfer
9a985d464c
Merge pull request #2257 from Human-Connection/bump_metascraper_modules
build(deps): bump metascraper modules
2019-11-18 22:00:26 +01:00
roschaefer
978347ba7b Tell github-linguists to ignore snapshots 2019-11-16 20:09:05 +01:00
roschaefer
034a353367 Hard-code graphql schema
Apparently, `neo4j-graphql-js` *replaces* the schema partly. When we use
join models like `EMOTED`, `neo4j-graphql-js` puts in a join model with
the two names of the connected types.
2019-11-15 11:04:07 +01:00
roschaefer
2a9e182649 fix: performance issue with ordering
@mattwr18 @aonomike
You must never `ORDER BY` a property with a `@cypher` directive. Reason:
The order by performance will be terribly poor.

See my issue:
https://github.com/neo4j-graphql/neo4j-graphql-js/issues/239
And my PR:
https://github.com/neo4j-graphql/neo4j-graphql-js/pull/247
2019-10-22 20:00:12 +02:00
mattwr18
8872dc16cf Follow @Tirokk's PR review suggestions
- add type :User to match
- remove unneeded outdated pinPost
2019-10-18 18:27:20 +02:00
mattwr18
9f70012556 Fix lint 2019-10-18 15:55:47 +02:00
mattwr18
be0c8044e8 Return pinnedAt date from pinPost resolver/clean up
- it's good to return the pinnedAt date for ordering
- move test to a better describe block
- remove unneeded outdated variables from graphql/PostQuery UpdatePost
- fix indentation in Post.gql
- fix pinnedAt to return pinned.createdAt, not post.createdAt

Co-authored-by: Mike Aono <aonomike@gmail.com>
2019-10-18 15:10:26 +02:00
mattwr18
8b27250393 Fix vue warning webapp, try to find source of cypress failure
- clean up
2019-10-17 22:44:44 +02:00
mattwr18
973912fb87 Add tests for unpinPost, refactor
- following @roschaefer's PR review suggestions
- simplify UpdatePost by using pinPost/unpinPost
- did not remove filtering because attempting to have two queries caused
problems as well to do with duplicate records, etc... and it's working
now
2019-10-17 21:51:41 +02:00
mattwr18
dd55d11739 Add backend test for PostOrdering 2019-10-17 17:56:16 +02:00
mattwr18
f1243c6df0 Add createdAt attribute to PINNED and test 2019-10-17 17:56:16 +02:00
mattwr18
0007533b8c Add tests that admin can pin anyone's post/limit 1 pinned post 2019-10-17 17:56:16 +02:00
mattwr18
64f9d02c1a Start refactoring backend to pin posts on update
- we want to give the admins the ability to create posts, then pin them
later, or pin other admins posts, etc...
2019-10-17 17:56:15 +02:00
aonomike
56d88d6e84 Resolve failing test 2019-10-17 17:56:15 +02:00
aonomike
ab06e8a91f Add relationship for pinned posts and user
- The CreateUser mutation now returns the user who pinned a post and so we can see the user who pinned the post
2019-10-17 17:56:15 +02:00
mattwr18
774581f2e0 Allow admins to create a post as pinned
- at the moment, it is created as a property of Post, but will be
refactored to create a relationship[:PINNED] from the admin to the Post

- Co-authored-by: kachulio1 <jngugi88@gmail.com>
2019-10-17 17:56:15 +02:00
mattwr18
d1ecac4580 Write tests to ensure createdAt is not deleted on update
- we had a silly serious bug by overwriting all attributes at the time
of UpdatePost
- tests in place to ensure we don't accidentally delete our createdAt
attribute
2019-09-13 20:14:47 +02:00
aonomike
785b59f96e Test filter by followed by 2019-09-10 23:32:55 +03:00
mattwr18
b89043166b Add backend tests for filtering posts by emotions
- Co-authored-by: Mike Aono <aonomike@gmail.com>
2019-09-09 16:35:11 +02:00
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
672f19e6d1 More of @mattwr18's suggestions 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
2033b1791c Fix posts resolver spec 2019-09-03 21:28:29 +02:00
Matt Rider
cd5e492569 Await relation be added 2019-08-23 12:18:53 +02:00
Matt Rider
773779e5f1 Fix UpdatePost resolver/validations 2019-08-23 10:57:11 +02:00
Matt Rider
8735045d11 Update cypress tests, post query 2019-08-20 20:13:29 +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
roschaefer
5103bdbc2a Fix tests 2019-08-13 11:50:33 +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