Merge branch 'master' of github.com:Human-Connection/Human-Connection into 778-categories-for-posts

This commit is contained in:
Matt Rider 2019-07-01 14:10:38 -03:00
commit b8ea32cfc1
21 changed files with 445 additions and 212 deletions

View File

@ -47,21 +47,21 @@
"apollo-client": "~2.6.3", "apollo-client": "~2.6.3",
"apollo-link-context": "~1.0.18", "apollo-link-context": "~1.0.18",
"apollo-link-http": "~1.5.15", "apollo-link-http": "~1.5.15",
"apollo-server": "~2.6.4", "apollo-server": "~2.6.7",
"bcryptjs": "~2.4.3", "bcryptjs": "~2.4.3",
"cheerio": "~1.0.0-rc.3", "cheerio": "~1.0.0-rc.3",
"cors": "~2.8.5", "cors": "~2.8.5",
"cross-env": "~5.2.0", "cross-env": "~5.2.0",
"date-fns": "2.0.0-alpha.37", "date-fns": "2.0.0-beta.2",
"debug": "~4.1.1", "debug": "~4.1.1",
"dotenv": "~8.0.0", "dotenv": "~8.0.0",
"express": "~4.17.1", "express": "~4.17.1",
"faker": "Marak/faker.js#master", "faker": "Marak/faker.js#master",
"graphql": "~14.3.1", "graphql": "~14.4.0",
"graphql-custom-directives": "~0.2.14", "graphql-custom-directives": "~0.2.14",
"graphql-iso-date": "~3.6.1", "graphql-iso-date": "~3.6.1",
"graphql-middleware": "~3.0.2", "graphql-middleware": "~3.0.2",
"graphql-shield": "~5.7.1", "graphql-shield": "~5.6.1",
"graphql-tag": "~2.10.1", "graphql-tag": "~2.10.1",
"graphql-yoga": "~1.18.0", "graphql-yoga": "~1.18.0",
"helmet": "~3.18.0", "helmet": "~3.18.0",
@ -88,14 +88,14 @@
"@babel/plugin-proposal-throw-expressions": "^7.2.0", "@babel/plugin-proposal-throw-expressions": "^7.2.0",
"@babel/preset-env": "~7.4.5", "@babel/preset-env": "~7.4.5",
"@babel/register": "~7.4.4", "@babel/register": "~7.4.4",
"apollo-server-testing": "~2.6.6", "apollo-server-testing": "~2.6.7",
"babel-core": "~7.0.0-0", "babel-core": "~7.0.0-0",
"babel-eslint": "~10.0.2", "babel-eslint": "~10.0.2",
"babel-jest": "~24.8.0", "babel-jest": "~24.8.0",
"chai": "~4.2.0", "chai": "~4.2.0",
"cucumber": "~5.1.0", "cucumber": "~5.1.0",
"eslint": "~6.0.1", "eslint": "~6.0.1",
"eslint-config-prettier": "~5.0.0", "eslint-config-prettier": "~6.0.0",
"eslint-config-standard": "~12.0.0", "eslint-config-standard": "~12.0.0",
"eslint-plugin-import": "~2.18.0", "eslint-plugin-import": "~2.18.0",
"eslint-plugin-jest": "~22.7.1", "eslint-plugin-jest": "~22.7.1",

View File

@ -12,7 +12,6 @@ const storeUpload = ({ createReadStream, fileLocation }) =>
export default async function fileUpload(params, { file, url }, uploadCallback = storeUpload) { export default async function fileUpload(params, { file, url }, uploadCallback = storeUpload) {
const upload = params[file] const upload = params[file]
if (upload) { if (upload) {
const { createReadStream, filename } = await upload const { createReadStream, filename } = await upload
const { name } = path.parse(filename) const { name } = path.parse(filename)

View File

@ -143,7 +143,7 @@ describe('users', () => {
let deleteUserVariables let deleteUserVariables
let asAuthor let asAuthor
const deleteUserMutation = gql` const deleteUserMutation = gql`
mutation($id: ID!, $resource: [String]) { mutation($id: ID!, $resource: [Deletable]) {
DeleteUser(id: $id, resource: $resource) { DeleteUser(id: $id, resource: $resource) {
id id
contributions { contributions {

View File

@ -1 +1 @@
scalar Upload scalar Upload

View File

@ -40,7 +40,6 @@ type Mutation {
follow(id: ID!, type: FollowTypeEnum): Boolean! follow(id: ID!, type: FollowTypeEnum): Boolean!
# Unfollow the given Type and ID # Unfollow the given Type and ID
unfollow(id: ID!, type: FollowTypeEnum): Boolean! unfollow(id: ID!, type: FollowTypeEnum): Boolean!
DeleteUser(id: ID!, resource: [String]): User
CreatePost( CreatePost(
id: ID id: ID
activityId: String activityId: String
@ -59,6 +58,7 @@ type Mutation {
categoryIds: [ID] categoryIds: [ID]
contentExcerpt: String contentExcerpt: String
): Post ): Post
DeleteUser(id: ID!, resource: [Deletable]): User
} }
type Statistics { type Statistics {
@ -110,6 +110,11 @@ type Report {
user: User @relation(name: "REPORTED", direction: "OUT") user: User @relation(name: "REPORTED", direction: "OUT")
} }
enum Deletable {
Post
Comment
}
enum ShoutTypeEnum { enum ShoutTypeEnum {
Post Post
Organization Organization

View File

@ -1110,10 +1110,10 @@
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0"
integrity sha512-sCZy4SxP9rN2w30Hlmg5dtdRwgYQfYRiLo9usw8X9cxlf+H4FqM1xX7+sNH7NNKVdbXMJWqva7iyy+fxh/V7fA== integrity sha512-sCZy4SxP9rN2w30Hlmg5dtdRwgYQfYRiLo9usw8X9cxlf+H4FqM1xX7+sNH7NNKVdbXMJWqva7iyy+fxh/V7fA==
"@types/yup@0.26.17": "@types/yup@0.26.16":
version "0.26.17" version "0.26.16"
resolved "https://registry.yarnpkg.com/@types/yup/-/yup-0.26.17.tgz#5cb7cfc211d8e985b21d88289542591c92cad9dc" resolved "https://registry.yarnpkg.com/@types/yup/-/yup-0.26.16.tgz#75c428236207c48d9f8062dd1495cda8c5485a15"
integrity sha512-MN7VHlPsZQ2MTBxLE2Gl+Qfg2WyKsoz+vIr8xN0OSZ4AvJDrrKBlxc8b59UXCCIG9tPn9XhxTXh3j/htHbzC2Q== integrity sha512-E2RNc7DSeQ+2EIJ1H3+yFjYu6YiyQBUJ7yNpIxomrYJ3oFizLZ5yDS3T1JTUNBC2OCRkgnhLS0smob5UuCHfNA==
"@types/zen-observable@^0.5.3": "@types/zen-observable@^0.5.3":
version "0.5.4" version "0.5.4"
@ -1279,14 +1279,6 @@ anymatch@^2.0.0:
micromatch "^3.1.4" micromatch "^3.1.4"
normalize-path "^2.1.1" normalize-path "^2.1.1"
apollo-cache-control@0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/apollo-cache-control/-/apollo-cache-control-0.7.2.tgz#b8852422d973c582493e85c776abc9c660090162"
integrity sha512-7prjFN8H9lRE0npqGG8kM3XICvNCcgQt6eCy8kkcPOIZwM+F8m8ShjEfNF9UWW32i+poOk3G67HegPRyjCc6/Q==
dependencies:
apollo-server-env "2.4.0"
graphql-extensions "0.7.2"
apollo-cache-control@0.7.4: apollo-cache-control@0.7.4:
version "0.7.4" version "0.7.4"
resolved "https://registry.yarnpkg.com/apollo-cache-control/-/apollo-cache-control-0.7.4.tgz#0cb5c7be0e0dd0c44b1257144cd7f9f2a3c374e6" resolved "https://registry.yarnpkg.com/apollo-cache-control/-/apollo-cache-control-0.7.4.tgz#0cb5c7be0e0dd0c44b1257144cd7f9f2a3c374e6"
@ -1350,29 +1342,17 @@ apollo-engine-reporting-protobuf@0.3.1:
dependencies: dependencies:
protobufjs "^6.8.6" protobufjs "^6.8.6"
apollo-engine-reporting@1.3.2: apollo-engine-reporting@1.3.5:
version "1.3.2" version "1.3.5"
resolved "https://registry.yarnpkg.com/apollo-engine-reporting/-/apollo-engine-reporting-1.3.2.tgz#b2569f79eb1a7a7380f49340db61465f449284fe" resolved "https://registry.yarnpkg.com/apollo-engine-reporting/-/apollo-engine-reporting-1.3.5.tgz#075424d39dfe77a20f96e8e33b7ae52d58c38e1e"
integrity sha512-Q9XUZ3CTqddjCswlbn+OD2oYxZ5p4lCAnsWOGMfYnSmCXLagyNK28UFFQodjFOy73p6nlTAg9cwaJ9yMOBeeXA== integrity sha512-pSwjPgXK/elFsR22LXALtT3jI4fpEpeTNTHgNwLVLohaolusMYgBc/9FnVyFWFfMFS9k+3RmfeQdHhZ6T7WKFQ==
dependencies: dependencies:
apollo-engine-reporting-protobuf "0.3.1" apollo-engine-reporting-protobuf "0.3.1"
apollo-graphql "^0.3.2" apollo-graphql "^0.3.3"
apollo-server-core "2.6.4" apollo-server-core "2.6.7"
apollo-server-env "2.4.0" apollo-server-env "2.4.0"
async-retry "^1.2.1" async-retry "^1.2.1"
graphql-extensions "0.7.3" graphql-extensions "0.7.6"
apollo-engine-reporting@1.3.4:
version "1.3.4"
resolved "https://registry.yarnpkg.com/apollo-engine-reporting/-/apollo-engine-reporting-1.3.4.tgz#65e12f94221d80b3b1740c26e82ce9bb6bdfb7ee"
integrity sha512-DJdYghyUBzT0/LcPLwuQNXDCw06r1RfxkVfNTGKoTv6a+leVvjhDJmXvc+jSuBPwaNsc+RYRnfyQ2qUn9fmfyA==
dependencies:
apollo-engine-reporting-protobuf "0.3.1"
apollo-graphql "^0.3.2"
apollo-server-core "2.6.6"
apollo-server-env "2.4.0"
async-retry "^1.2.1"
graphql-extensions "0.7.5"
apollo-env@0.5.1: apollo-env@0.5.1:
version "0.5.1" version "0.5.1"
@ -1391,10 +1371,10 @@ apollo-errors@^1.9.0:
assert "^1.4.1" assert "^1.4.1"
extendable-error "^0.1.5" extendable-error "^0.1.5"
apollo-graphql@^0.3.2: apollo-graphql@^0.3.3:
version "0.3.2" version "0.3.3"
resolved "https://registry.yarnpkg.com/apollo-graphql/-/apollo-graphql-0.3.2.tgz#8881a87f1d5fcf80837b34dba90737e664eabe9a" resolved "https://registry.yarnpkg.com/apollo-graphql/-/apollo-graphql-0.3.3.tgz#ce1df194f6e547ad3ce1e35b42f9c211766e1658"
integrity sha512-YbzYGR14GV0023m//EU66vOzZ3i7c04V/SF8Qk+60vf1sOWyKgO6mxZJ4BKhw10qWUayirhSDxq3frYE+qSG0A== integrity sha512-t3CO/xIDVsCG2qOvx2MEbuu4b/6LzQjcBBwiVnxclmmFyAxYCIe7rpPlnLHSq7HyOMlCWDMozjoeWfdqYSaLqQ==
dependencies: dependencies:
apollo-env "0.5.1" apollo-env "0.5.1"
lodash.sortby "^4.7.0" lodash.sortby "^4.7.0"
@ -1442,50 +1422,24 @@ apollo-server-caching@0.4.0:
dependencies: dependencies:
lru-cache "^5.0.0" lru-cache "^5.0.0"
apollo-server-core@2.6.4: apollo-server-core@2.6.7:
version "2.6.4" version "2.6.7"
resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-2.6.4.tgz#0372e3a28f221b9db83bdfbb0fd0b2960cd29bab" resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-2.6.7.tgz#85b0310f40cfec43a702569c73af16d88776a6f0"
integrity sha512-GBF+tQoJ/ysaY2CYMkuuAwJM1nk1yLJumrsBTFfcvalSzS64VdS5VN/zox1eRI+LHQQzHM18HYEAgDGa/EX+gw== integrity sha512-HfOGLvEwPgDWTvd3ZKRPEkEnICKb7xadn1Mci4+auMTsL/NVkfpjPa8cdzubi/kS2/MvioIn7Bg74gmiSLghGQ==
dependencies:
"@apollographql/apollo-tools" "^0.3.6"
"@apollographql/graphql-playground-html" "1.6.20"
"@types/ws" "^6.0.0"
apollo-cache-control "0.7.2"
apollo-datasource "0.5.0"
apollo-engine-reporting "1.3.2"
apollo-server-caching "0.4.0"
apollo-server-env "2.4.0"
apollo-server-errors "2.3.0"
apollo-server-plugin-base "0.5.3"
apollo-tracing "0.7.2"
fast-json-stable-stringify "^2.0.0"
graphql-extensions "0.7.3"
graphql-subscriptions "^1.0.0"
graphql-tag "^2.9.2"
graphql-tools "^4.0.0"
graphql-upload "^8.0.2"
sha.js "^2.4.11"
subscriptions-transport-ws "^0.9.11"
ws "^6.0.0"
apollo-server-core@2.6.6:
version "2.6.6"
resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-2.6.6.tgz#55fea7980a943948c49dea20d81b9bbfc0e04f87"
integrity sha512-PFSjJbqkV1eetfFJxu11gzklQYC8BrF0RZfvC1d1mhvtxAOKl25uhPHxltN0Omyjp7LW4YeoC6zwl9rLWuhZFQ==
dependencies: dependencies:
"@apollographql/apollo-tools" "^0.3.6" "@apollographql/apollo-tools" "^0.3.6"
"@apollographql/graphql-playground-html" "1.6.20" "@apollographql/graphql-playground-html" "1.6.20"
"@types/ws" "^6.0.0" "@types/ws" "^6.0.0"
apollo-cache-control "0.7.4" apollo-cache-control "0.7.4"
apollo-datasource "0.5.0" apollo-datasource "0.5.0"
apollo-engine-reporting "1.3.4" apollo-engine-reporting "1.3.5"
apollo-server-caching "0.4.0" apollo-server-caching "0.4.0"
apollo-server-env "2.4.0" apollo-server-env "2.4.0"
apollo-server-errors "2.3.0" apollo-server-errors "2.3.0"
apollo-server-plugin-base "0.5.5" apollo-server-plugin-base "0.5.6"
apollo-tracing "0.7.3" apollo-tracing "0.7.3"
fast-json-stable-stringify "^2.0.0" fast-json-stable-stringify "^2.0.0"
graphql-extensions "0.7.5" graphql-extensions "0.7.6"
graphql-subscriptions "^1.0.0" graphql-subscriptions "^1.0.0"
graphql-tag "^2.9.2" graphql-tag "^2.9.2"
graphql-tools "^4.0.0" graphql-tools "^4.0.0"
@ -1516,10 +1470,10 @@ apollo-server-errors@2.3.0:
resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-2.3.0.tgz#700622b66a16dffcad3b017e4796749814edc061" resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-2.3.0.tgz#700622b66a16dffcad3b017e4796749814edc061"
integrity sha512-rUvzwMo2ZQgzzPh2kcJyfbRSfVKRMhfIlhY7BzUfM4x6ZT0aijlgsf714Ll3Mbf5Fxii32kD0A/DmKsTecpccw== integrity sha512-rUvzwMo2ZQgzzPh2kcJyfbRSfVKRMhfIlhY7BzUfM4x6ZT0aijlgsf714Ll3Mbf5Fxii32kD0A/DmKsTecpccw==
apollo-server-express@2.6.4: apollo-server-express@2.6.7:
version "2.6.4" version "2.6.7"
resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-2.6.4.tgz#fc1d661be73fc1880aa53a56e1abe3733d08eada" resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-2.6.7.tgz#22307e08b75be1553f4099d00028abe52597767d"
integrity sha512-U6hiZxty/rait39V5d+QeueNHlwfl68WbYtsutDUVxnq2Jws2ZDrvIkaWWN6HQ77+nBy5gGVxycvWIyoHHfi+g== integrity sha512-qbCQM+8LxXpwPNN5Sdvcb+Sne8zuCORFt25HJtPJRkHlyBUzOd7JA7SEnUn5e2geTiiGoVIU5leh+++C51udTw==
dependencies: dependencies:
"@apollographql/graphql-playground-html" "1.6.20" "@apollographql/graphql-playground-html" "1.6.20"
"@types/accepts" "^1.3.5" "@types/accepts" "^1.3.5"
@ -1527,7 +1481,7 @@ apollo-server-express@2.6.4:
"@types/cors" "^2.8.4" "@types/cors" "^2.8.4"
"@types/express" "4.17.0" "@types/express" "4.17.0"
accepts "^1.3.5" accepts "^1.3.5"
apollo-server-core "2.6.4" apollo-server-core "2.6.7"
body-parser "^1.18.3" body-parser "^1.18.3"
cors "^2.8.4" cors "^2.8.4"
graphql-subscriptions "^1.0.0" graphql-subscriptions "^1.0.0"
@ -1555,42 +1509,29 @@ apollo-server-module-graphiql@^1.3.4, apollo-server-module-graphiql@^1.4.0:
resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.4.0.tgz#c559efa285578820709f1769bb85d3b3eed3d8ec" resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.4.0.tgz#c559efa285578820709f1769bb85d3b3eed3d8ec"
integrity sha512-GmkOcb5he2x5gat+TuiTvabnBf1m4jzdecal3XbXBh/Jg+kx4hcvO3TTDFQ9CuTprtzdcVyA11iqG7iOMOt7vA== integrity sha512-GmkOcb5he2x5gat+TuiTvabnBf1m4jzdecal3XbXBh/Jg+kx4hcvO3TTDFQ9CuTprtzdcVyA11iqG7iOMOt7vA==
apollo-server-plugin-base@0.5.3: apollo-server-plugin-base@0.5.6:
version "0.5.3" version "0.5.6"
resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.5.3.tgz#234c6330c412a2e83ff49305a0c2f991fb40a266" resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.5.6.tgz#3a7128437a0f845e7d873fa43ef091ff7bf27975"
integrity sha512-Ax043vQTzPgFeJk6m6hmPm9NMfogO3LlTKJfrWHuyZhPNeTLweHNK30vpdzzgPalcryyDMDfLYFzxuDm0W+rRQ== integrity sha512-wJvcPqfm/kiBwY5JZT85t2A4pcHv24xdQIpWMNt1zsnx77lIZqJmhsc22eSUSrlnYqUMXC4XMVgSUfAO4oI9wg==
apollo-server-plugin-base@0.5.5: apollo-server-testing@~2.6.7:
version "0.5.5" version "2.6.7"
resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.5.5.tgz#364e4a2fca4d95ddeb9fd3e78940ed1da58865c2" resolved "https://registry.yarnpkg.com/apollo-server-testing/-/apollo-server-testing-2.6.7.tgz#cfc6366921eb99fd0cbc5d02552a8a5b268787d5"
integrity sha512-agiuhknyu3lnnEsqUh99tzxwPCGp+TuDK+TSRTkXU1RUG6lY4C3uJp0JGJw03cP+M6ze73TbRjMA4E68g/ks5A== integrity sha512-lqgZuSqBd5hkRILeVEleo2ScJjukR/E71Mv67vPBUs01s0gEHNnjSRnuOJJOM3cAFBQOdKPc42cHGANzf2ZZTw==
apollo-server-testing@~2.6.6:
version "2.6.6"
resolved "https://registry.yarnpkg.com/apollo-server-testing/-/apollo-server-testing-2.6.6.tgz#3d96486ebdb151219183fcb715973a8385c66e0a"
integrity sha512-GfzEAqXGzhWp1YgNJONAijC3mC34E6cI5XiOdLX9FGAnBmZvDURlZwloZbdNgvqvXnwuxuNgo4xvCnTe7kndqg==
dependencies: dependencies:
apollo-server-core "2.6.6" apollo-server-core "2.6.7"
apollo-server@~2.6.4: apollo-server@~2.6.7:
version "2.6.4" version "2.6.7"
resolved "https://registry.yarnpkg.com/apollo-server/-/apollo-server-2.6.4.tgz#34b3a50135e20b8df8c194a14e4636eb9c2898b2" resolved "https://registry.yarnpkg.com/apollo-server/-/apollo-server-2.6.7.tgz#b707ede529b4d45f2f00a74f3b457658b0e62e83"
integrity sha512-f0TZOc969XNNlSm8sVsU34D8caQfPNwS0oqmWUxb8xXl88HlFzB+HBmOU6ZEKdpMCksTNDbqYo0jXiGJ0rL/0g== integrity sha512-4wk9JykURLed6CnNIj9jhU6ueeTVmGBTyAnnvnlhRrOf50JAFszUErZIKg6lw5vVr5riaByrGFIkMBTySCHgPQ==
dependencies: dependencies:
apollo-server-core "2.6.4" apollo-server-core "2.6.7"
apollo-server-express "2.6.4" apollo-server-express "2.6.7"
express "^4.0.0" express "^4.0.0"
graphql-subscriptions "^1.0.0" graphql-subscriptions "^1.0.0"
graphql-tools "^4.0.0" graphql-tools "^4.0.0"
apollo-tracing@0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/apollo-tracing/-/apollo-tracing-0.7.2.tgz#7730159a4670bca465ac1bfa01f9902610a7aba4"
integrity sha512-bT4/n8Vy9DweC3+XWJelJD41FBlKMXR0OVxjLMiCe9clb4yTgKhYxRGTyh9KjmhWsng9gG/DphO0ixWsOgdXmA==
dependencies:
apollo-server-env "2.4.0"
graphql-extensions "0.7.2"
apollo-tracing@0.7.3: apollo-tracing@0.7.3:
version "0.7.3" version "0.7.3"
resolved "https://registry.yarnpkg.com/apollo-tracing/-/apollo-tracing-0.7.3.tgz#8533e3e2dca2d5a25e8439ce498ea33ff4d159ee" resolved "https://registry.yarnpkg.com/apollo-tracing/-/apollo-tracing-0.7.3.tgz#8533e3e2dca2d5a25e8439ce498ea33ff4d159ee"
@ -2643,10 +2584,10 @@ data-urls@^1.0.0:
whatwg-mimetype "^2.2.0" whatwg-mimetype "^2.2.0"
whatwg-url "^7.0.0" whatwg-url "^7.0.0"
date-fns@2.0.0-alpha.37: date-fns@2.0.0-beta.2:
version "2.0.0-alpha.37" version "2.0.0-beta.2"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.37.tgz#c58b3e827da4f860ec8dc123e54019efb4a610e0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-beta.2.tgz#ccd556df832ef761baa88c600f53d2e829245999"
integrity sha512-fyIv/h6fkFd1u2NHXni5LPRPoa9FFh3hY67JSjNfa+k/u4EKvfrpGtoTM16Y/BJOqTb4W05UjcmwBna1ElyxDA== integrity sha512-4cicZF707RNerr3/Q3CcdLo+3OHMCfrRXE7h5iFgn7AMvX07sqKLxSf8Yp+WJW5bvKr2cy9/PkctXLv4iFtOaA==
debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
version "2.6.9" version "2.6.9"
@ -3059,10 +3000,10 @@ escodegen@^1.9.1:
optionalDependencies: optionalDependencies:
source-map "~0.6.1" source-map "~0.6.1"
eslint-config-prettier@~5.0.0: eslint-config-prettier@~6.0.0:
version "5.0.0" version "6.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-5.0.0.tgz#f7a94b2b8ae7cbf25842c36fa96c6d32cd0a697c" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz#f429a53bde9fc7660e6353910fd996d6284d3c25"
integrity sha512-c17Aqiz5e8LEqoc/QPmYnaxQFAHTx2KlCZBPxXXjEMmNchOLnV/7j0HoPZuC+rL/tDC9bazUYOKJW9bOhftI/w== integrity sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA==
dependencies: dependencies:
get-stdin "^6.0.0" get-stdin "^6.0.0"
@ -3779,20 +3720,6 @@ graphql-deduplicator@^2.0.1:
resolved "https://registry.yarnpkg.com/graphql-deduplicator/-/graphql-deduplicator-2.0.2.tgz#d8608161cf6be97725e178df0c41f6a1f9f778f3" resolved "https://registry.yarnpkg.com/graphql-deduplicator/-/graphql-deduplicator-2.0.2.tgz#d8608161cf6be97725e178df0c41f6a1f9f778f3"
integrity sha512-0CGmTmQh4UvJfsaTPppJAcHwHln8Ayat7yXXxdnuWT+Mb1dBzkbErabCWzjXyKh/RefqlGTTA7EQOZHofMaKJA== integrity sha512-0CGmTmQh4UvJfsaTPppJAcHwHln8Ayat7yXXxdnuWT+Mb1dBzkbErabCWzjXyKh/RefqlGTTA7EQOZHofMaKJA==
graphql-extensions@0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.2.tgz#8711543f835661eaf24b48d6ac2aad44dbbd5506"
integrity sha512-TuVINuAOrEtzQAkAlCZMi9aP5rcZ+pVaqoBI5fD2k5O9fmb8OuXUQOW028MUhC66tg4E7h4YSF1uYUIimbu4SQ==
dependencies:
"@apollographql/apollo-tools" "^0.3.6"
graphql-extensions@0.7.3:
version "0.7.3"
resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.3.tgz#2ab7331c72ae657e4cbfa4ff004c400b19f56cdf"
integrity sha512-D+FZM0t5gFntJUizeRCurZuUqsyVP13CRejRX+cDJivyGkE6OMWYkCWlzHcbye79q+hYN1m6a3NhlrJRaD9D0w==
dependencies:
"@apollographql/apollo-tools" "^0.3.6"
graphql-extensions@0.7.4: graphql-extensions@0.7.4:
version "0.7.4" version "0.7.4"
resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.4.tgz#78327712822281d5778b9210a55dc59c93a9c184" resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.4.tgz#78327712822281d5778b9210a55dc59c93a9c184"
@ -3800,10 +3727,10 @@ graphql-extensions@0.7.4:
dependencies: dependencies:
"@apollographql/apollo-tools" "^0.3.6" "@apollographql/apollo-tools" "^0.3.6"
graphql-extensions@0.7.5: graphql-extensions@0.7.6:
version "0.7.5" version "0.7.6"
resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.5.tgz#fab2b9e53cf6014952e6547456d50680ff0ea579" resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.6.tgz#80cdddf08b0af12525529d1922ee2ea0d0cc8ecf"
integrity sha512-B1m+/WEJa3IYKWqBPS9W/7OasfPmlHOSz5hpEAq2Jbn6T0FQ/d2YWFf2HBETHR3RR2qfT+55VMiYovl2ga3qcg== integrity sha512-RV00O3YFD1diehvdja180BlKOGWgeigr/8/Wzr6lXwLcFtk6FecQC/7nf6oW1qhuXczHyNjt/uCr0WWbWq6mYg==
dependencies: dependencies:
"@apollographql/apollo-tools" "^0.3.6" "@apollographql/apollo-tools" "^0.3.6"
@ -3861,12 +3788,12 @@ graphql-request@~1.8.2:
dependencies: dependencies:
cross-fetch "2.2.2" cross-fetch "2.2.2"
graphql-shield@~5.7.1: graphql-shield@~5.6.1:
version "5.7.1" version "5.6.2"
resolved "https://registry.yarnpkg.com/graphql-shield/-/graphql-shield-5.7.1.tgz#04095fb8148a463997f7c509d4aeb2a6abf79f98" resolved "https://registry.yarnpkg.com/graphql-shield/-/graphql-shield-5.6.2.tgz#27eaad2ce2591ed81b1203e8915df99b28fb5ad5"
integrity sha512-UZ0K1uAqRAoGA1U2DsUu4vIZX2Vents4Xim99GFEUBTgvSDkejiE+k/Dywqfu76lJFEE8qu3vG5fhJN3SmnKbA== integrity sha512-DlS6r39s7AaP07yMM6i7GI87UkfL65O1tUPW4kNqp67fD1BU71Ekl7Kt/1L3rxS/gcQdGufuKka5oKUa5GKo2A==
dependencies: dependencies:
"@types/yup" "0.26.17" "@types/yup" "0.26.16"
lightercollective "^0.3.0" lightercollective "^0.3.0"
object-hash "^1.3.1" object-hash "^1.3.1"
yup "^0.27.0" yup "^0.27.0"
@ -3939,10 +3866,10 @@ graphql-yoga@~1.18.0:
graphql-upload "^8.0.0" graphql-upload "^8.0.0"
subscriptions-transport-ws "^0.9.8" subscriptions-transport-ws "^0.9.8"
"graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0", graphql@^14.2.1, graphql@~14.3.1: "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0", graphql@^14.2.1, graphql@~14.4.0:
version "14.3.1" version "14.4.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.3.1.tgz#b3aa50e61a841ada3c1f9ccda101c483f8e8c807" resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.4.0.tgz#e97086acfc0338e4fdc8f7dba519c6b8a6badfd9"
integrity sha512-FZm7kAa3FqKdXy8YSSpAoTtyDFMIYSpCDOr+3EqlI1bxmtHu+Vv/I2vrSeT1sBOEnEniX3uo4wFhFdS/8XN6gA== integrity sha512-E55z1oK6e4cGxCqlSsRWytYDPcIUxky3XkbuQUf6TIjCmn6C7CuBJpmkMF1066q95yPAGOZVPTVT7jABKbRFSA==
dependencies: dependencies:
iterall "^1.2.2" iterall "^1.2.2"

View File

@ -21,7 +21,7 @@
"devDependencies": { "devDependencies": {
"codecov": "^3.5.0", "codecov": "^3.5.0",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"cypress": "^3.3.1", "cypress": "^3.3.2",
"cypress-cucumber-preprocessor": "^1.12.0", "cypress-cucumber-preprocessor": "^1.12.0",
"cypress-file-upload": "^3.1.4", "cypress-file-upload": "^3.1.4",
"cypress-plugin-retries": "^1.2.2", "cypress-plugin-retries": "^1.2.2",

View File

@ -4,11 +4,14 @@ import Styleguide from '@human-connection/styleguide'
import Vuex from 'vuex' import Vuex from 'vuex'
import PostMutations from '~/graphql/PostMutations.js' import PostMutations from '~/graphql/PostMutations.js'
import CategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect' import CategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect'
import Filters from '~/plugins/vue-filters'
import TeaserImage from '~/components/TeaserImage/TeaserImage'
const localVue = createLocalVue() const localVue = createLocalVue()
localVue.use(Vuex) localVue.use(Vuex)
localVue.use(Styleguide) localVue.use(Styleguide)
localVue.use(Filters)
config.stubs['no-ssr'] = '<span><slot /></span>' config.stubs['no-ssr'] = '<span><slot /></span>'
@ -22,6 +25,10 @@ describe('ContributionForm.vue', () => {
let propsData let propsData
const postTitle = 'this is a title for a post' const postTitle = 'this is a title for a post'
const postContent = 'this is a post' const postContent = 'this is a post'
const imageUpload = {
file: { filename: 'avataar.svg', previewElement: '' },
url: 'someUrlToImage',
}
beforeEach(() => { beforeEach(() => {
mocks = { mocks = {
@ -107,6 +114,7 @@ describe('ContributionForm.vue', () => {
language: 'en', language: 'en',
id: null, id: null,
categoryIds: null, categoryIds: null,
imageUpload: null,
}, },
} }
postTitleInput = wrapper.find('.ds-input') postTitleInput = wrapper.find('.ds-input')
@ -135,6 +143,11 @@ describe('ContributionForm.vue', () => {
const categoryIds = ['cat12', 'cat15', 'cat37'] const categoryIds = ['cat12', 'cat15', 'cat37']
expectedParams.variables.categoryIds = categoryIds expectedParams.variables.categoryIds = categoryIds
wrapper.find(CategoriesSelect).vm.$emit('updateCategories', categoryIds) wrapper.find(CategoriesSelect).vm.$emit('updateCategories', categoryIds)
})
it('supports adding a teaser image', async () => {
expectedParams.variables.imageUpload = imageUpload
wrapper.find(TeaserImage).vm.$emit('addTeaserImage', imageUpload)
await wrapper.find('form').trigger('submit') await wrapper.find('form').trigger('submit')
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams)) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams))
}) })
@ -158,6 +171,7 @@ describe('ContributionForm.vue', () => {
describe('handles errors', () => { describe('handles errors', () => {
beforeEach(async () => { beforeEach(async () => {
jest.useFakeTimers()
wrapper = Wrapper() wrapper = Wrapper()
postTitleInput = wrapper.find('.ds-input') postTitleInput = wrapper.find('.ds-input')
postTitleInput.setValue(postTitle) postTitleInput.setValue(postTitle)
@ -165,6 +179,7 @@ describe('ContributionForm.vue', () => {
// second submission causes mutation to reject // second submission causes mutation to reject
await wrapper.find('form').trigger('submit') await wrapper.find('form').trigger('submit')
}) })
it('shows an error toaster when apollo mutation rejects', async () => { it('shows an error toaster when apollo mutation rejects', async () => {
await wrapper.find('form').trigger('submit') await wrapper.find('form').trigger('submit')
await mocks.$apollo.mutate await mocks.$apollo.mutate
@ -182,6 +197,7 @@ describe('ContributionForm.vue', () => {
title: 'dies ist ein Post', title: 'dies ist ein Post',
content: 'auf Deutsch geschrieben', content: 'auf Deutsch geschrieben',
language: 'de', language: 'de',
imageUpload,
}, },
} }
wrapper = Wrapper() wrapper = Wrapper()
@ -203,10 +219,6 @@ describe('ContributionForm.vue', () => {
expect(wrapper.vm.form.content).toEqual(propsData.contribution.content) expect(wrapper.vm.form.content).toEqual(propsData.contribution.content)
}) })
it('sets language equal to contribution language', () => {
expect(wrapper.vm.form.language).toEqual({ value: propsData.contribution.language })
})
it('calls the UpdatePost apollo mutation', async () => { it('calls the UpdatePost apollo mutation', async () => {
expectedParams = { expectedParams = {
mutation: PostMutations().UpdatePost, mutation: PostMutations().UpdatePost,
@ -216,6 +228,7 @@ describe('ContributionForm.vue', () => {
language: propsData.contribution.language, language: propsData.contribution.language,
id: propsData.contribution.id, id: propsData.contribution.id,
categoryIds: null, categoryIds: null,
imageUpload,
}, },
} }
postTitleInput = wrapper.find('.ds-input') postTitleInput = wrapper.find('.ds-input')

View File

@ -2,6 +2,13 @@
<ds-form ref="contributionForm" v-model="form" :schema="formSchema" @submit="submit"> <ds-form ref="contributionForm" v-model="form" :schema="formSchema" @submit="submit">
<template slot-scope="{ errors }"> <template slot-scope="{ errors }">
<ds-card> <ds-card>
<hc-teaser-image :contribution="contribution" @addTeaserImage="addTeaserImage">
<img
v-if="contribution"
class="contribution-image"
:src="contribution.image | proxyApiUrl"
/>
</hc-teaser-image>
<ds-input model="title" class="post-title" placeholder="Title" name="title" autofocus /> <ds-input model="title" class="post-title" placeholder="Title" name="title" autofocus />
<no-ssr> <no-ssr>
<hc-editor :users="users" :value="form.content" @input="updateEditorContent" /> <hc-editor :users="users" :value="form.content" @input="updateEditorContent" />
@ -40,6 +47,7 @@
{{ $t('actions.save') }} {{ $t('actions.save') }}
</ds-button> </ds-button>
</div> </div>
<ds-space margin-bottom="large" />
</ds-card> </ds-card>
</template> </template>
</ds-form> </ds-form>
@ -52,11 +60,13 @@ import orderBy from 'lodash/orderBy'
import locales from '~/locales' import locales from '~/locales'
import PostMutations from '~/graphql/PostMutations.js' import PostMutations from '~/graphql/PostMutations.js'
import HcCategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect' import HcCategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect'
import HcTeaserImage from '~/components/TeaserImage/TeaserImage'
export default { export default {
components: { components: {
HcEditor, HcEditor,
HcCategoriesSelect, HcCategoriesSelect,
HcTeaserImage,
}, },
props: { props: {
contribution: { type: Object, default: () => {} }, contribution: { type: Object, default: () => {} },
@ -66,6 +76,7 @@ export default {
form: { form: {
title: '', title: '',
content: '', content: '',
teaserImage: null,
language: null, language: null,
languageOptions: [], languageOptions: [],
categoryIds: null, categoryIds: null,
@ -92,7 +103,7 @@ export default {
this.slug = contribution.slug this.slug = contribution.slug
this.form.content = contribution.content this.form.content = contribution.content
this.form.title = contribution.title this.form.title = contribution.title
this.form.language = { value: contribution.language } this.form.teaserImage = contribution.imageUpload
}, },
}, },
}, },
@ -110,7 +121,15 @@ export default {
}, },
methods: { methods: {
submit() { submit() {
const { title, content, language, categoryIds } = this.form const { title, content, teaserImage, categoryIds } = this.form
let language
if (this.form.language) {
language = this.form.language.value
} else if (this.contribution && this.contribution.language) {
language = this.contribution.language
} else {
language = this.$i18n.locale()
}
this.loading = true this.loading = true
this.$apollo this.$apollo
.mutate({ .mutate({
@ -119,8 +138,9 @@ export default {
id: this.id, id: this.id,
title, title,
content, content,
language: language ? language.value : this.$i18n.locale(),
categoryIds, categoryIds,
language,
imageUpload: teaserImage,
}, },
}) })
.then(res => { .then(res => {
@ -152,6 +172,9 @@ export default {
updateCategories(ids) { updateCategories(ids) {
this.form.categoryIds = ids this.form.categoryIds = ids
}, },
addTeaserImage(file) {
this.form.teaserImage = file
},
}, },
apollo: { apollo: {
User: { User: {
@ -184,8 +207,4 @@ export default {
padding-right: 0; padding-right: 0;
} }
} }
.contribution-form-footer {
border-top: $border-size-base solid $border-color-softest;
}
</style> </style>

View File

@ -111,7 +111,7 @@ export default {
this.$apollo this.$apollo
.mutate({ .mutate({
mutation: gql` mutation: gql`
mutation($id: ID!, $resource: [String]) { mutation($id: ID!, $resource: [Deletable]) {
DeleteUser(id: $id, resource: $resource) { DeleteUser(id: $id, resource: $resource) {
id id
} }

View File

@ -0,0 +1,61 @@
import { mount, createLocalVue } from '@vue/test-utils'
import TeaserImage from './TeaserImage.vue'
import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue()
localVue.use(Styleguide)
describe('TeaserImage.vue', () => {
let wrapper
let mocks
beforeEach(() => {
mocks = {
$toast: {
error: jest.fn(),
},
}
})
describe('mount', () => {
const Wrapper = () => {
return mount(TeaserImage, { mocks, localVue })
}
beforeEach(() => {
wrapper = Wrapper()
})
describe('File upload', () => {
const imageUpload = [
{ file: { filename: 'avataar.svg', previewElement: '' }, url: 'someUrlToImage' },
]
it('supports adding a teaser image', () => {
wrapper.vm.addTeaserImage(imageUpload)
expect(wrapper.emitted().addTeaserImage[0]).toEqual(imageUpload)
})
})
describe('handles errors', () => {
beforeEach(() => jest.useFakeTimers())
const message = 'File upload failed'
const fileError = { status: 'error' }
it('defaults to error false', () => {
expect(wrapper.vm.error).toEqual(false)
})
it('shows an error toaster when verror is called', () => {
wrapper.vm.verror(fileError, message)
expect(mocks.$toast.error).toHaveBeenCalledWith(fileError.status, message)
})
it('changes error status from false to true to false', () => {
wrapper.vm.verror(fileError, message)
expect(wrapper.vm.error).toEqual(true)
jest.runAllTimers()
expect(wrapper.vm.error).toEqual(false)
})
})
})
})

View File

@ -0,0 +1,197 @@
<template>
<vue-dropzone
:options="dropzoneOptions"
ref="el"
id="postdropzone"
:use-custom-slot="true"
@vdropzone-thumbnail="thumbnail"
@vdropzone-error="verror"
>
<div class="dz-message">
<div
:class="{
'hc-attachments-upload-area-post': createAndUpdate,
'hc-attachments-upload-area-update-post': contribution,
}"
>
<slot></slot>
<div
:class="{
'hc-drag-marker-post': createAndUpdate,
'hc-drag-marker-update-post': contribution,
}"
>
<ds-icon name="image" size="xxx-large" />
</div>
</div>
</div>
</vue-dropzone>
</template>
<script>
import vueDropzone from 'nuxt-dropzone'
export default {
components: {
vueDropzone,
},
props: {
contribution: { type: Object, default: () => {} },
},
data() {
return {
dropzoneOptions: {
url: this.addTeaserImage,
maxFilesize: 5.0,
previewTemplate: this.template(),
},
error: false,
createAndUpdate: true,
}
},
watch: {
error() {
let that = this
setTimeout(function() {
that.error = false
}, 2000)
},
},
methods: {
template() {
return `<div class="dz-preview dz-file-preview">
<div class="dz-image">
<div data-dz-thumbnail-bg></div>
</div>
</div>
`
},
verror(file, message) {
this.error = true
this.$toast.error(file.status, message)
},
addTeaserImage(file) {
this.$emit('addTeaserImage', file[0])
return ''
},
thumbnail: (file, dataUrl) => {
let thumbnailElement, contributionImage, uploadArea
if (file.previewElement) {
thumbnailElement = document.querySelectorAll('#postdropzone')[0]
contributionImage = document.querySelectorAll('.contribution-image')[0]
if (contributionImage) {
uploadArea = document.querySelectorAll('.hc-attachments-upload-area-update-post')[0]
uploadArea.removeChild(contributionImage)
uploadArea.classList.remove('hc-attachments-upload-area-update-post')
}
thumbnailElement.classList.add('image-preview')
thumbnailElement.alt = file.name
thumbnailElement.style.backgroundImage = 'url("' + dataUrl + '")'
}
},
},
}
</script>
<style lang="scss">
#postdropzone {
width: 100%;
min-height: 300px;
background-color: $background-color-softest;
}
#postdropzone.image-preview {
background-repeat: no-repeat;
background-size: cover;
background-position: center;
height: auto;
transition: all 0.2s ease-out;
width: 100%;
}
@media only screen and (max-width: 400px) {
#postdropzone.image-preview {
height: 200px;
}
}
@media only screen and (min-width: 401px) and (max-width: 960px) {
#postdropzone.image-preview {
height: 300px;
}
}
.hc-attachments-upload-area-post {
position: relative;
display: flex;
justify-content: center;
cursor: pointer;
}
.hc-attachments-upload-area-update-post img {
object-fit: cover;
object-position: center;
display: block;
width: 100%;
}
.hc-attachments-upload-area-update-post:hover {
opacity: 0.7;
}
.hc-drag-marker-post {
position: absolute;
width: 122px;
height: 122px;
border-radius: 100%;
display: flex;
align-items: center;
justify-content: center;
color: hsl(0, 0%, 25%);
transition: all 0.2s ease-out;
font-size: 60px;
margin: 80px 5px;
background-color: $background-color-softest;
opacity: 0.65;
&:before {
position: absolute;
content: '';
top: 0;
left: 0;
bottom: 0;
right: 0;
border-radius: 100%;
border: 20px solid $text-color-base;
visibility: hidden;
}
&:after {
position: absolute;
content: '';
top: 10px;
left: 10px;
bottom: 10px;
right: 10px;
border-radius: 100%;
border: $border-size-base dashed $text-color-base;
}
.hc-attachments-upload-area-post:hover & {
opacity: 1;
}
}
.hc-drag-marker-update-post {
opacity: 0;
}
.contribution-form-footer {
border-top: $border-size-base solid $border-color-softest;
}
.contribution-image {
max-height: 300px;
}
</style>

View File

@ -9,7 +9,7 @@
@vdropzone-error="verror" @vdropzone-error="verror"
> >
<div class="dz-message" @mouseover="hover = true" @mouseleave="hover = false"> <div class="dz-message" @mouseover="hover = true" @mouseleave="hover = false">
<hc-avatar :user="user" class="profile-avatar" size="x-large"></hc-avatar> <slot></slot>
<div class="hc-attachments-upload-area"> <div class="hc-attachments-upload-area">
<div class="hc-drag-marker"> <div class="hc-drag-marker">
<ds-icon v-if="hover" name="image" size="xxx-large" /> <ds-icon v-if="hover" name="image" size="xxx-large" />
@ -22,12 +22,10 @@
<script> <script>
import vueDropzone from 'nuxt-dropzone' import vueDropzone from 'nuxt-dropzone'
import gql from 'graphql-tag' import gql from 'graphql-tag'
import HcAvatar from '~/components/Avatar/Avatar.vue'
export default { export default {
components: { components: {
vueDropzone, vueDropzone,
HcAvatar,
}, },
props: { props: {
user: { type: Object, default: null }, user: { type: Object, default: null },

View File

@ -3,12 +3,42 @@ import gql from 'graphql-tag'
export default () => { export default () => {
return { return {
CreatePost: gql` CreatePost: gql`
mutation($title: String!, $content: String!, $language: String, $categoryIds: [ID]) { mutation(
$title: String!
$content: String!
$language: String
$categoryIds: [ID]
$imageUpload: Upload
) {
CreatePost( CreatePost(
title: $title title: $title
content: $content content: $content
language: $language language: $language
categoryIds: $categoryIds categoryIds: $categoryIds
imageUpload: $imageUpload
) {
title
content
contentExcerpt
language
imageUpload
}
}
`,
UpdatePost: gql`
mutation(
$id: ID!
$title: String!
$content: String!
$language: String
$imageUpload: Upload
) {
UpdatePost(
id: $id
title: $title
content: $content
language: $language
imageUpload: $imageUpload
) { ) {
id id
title title
@ -16,18 +46,7 @@ export default () => {
content content
contentExcerpt contentExcerpt
language language
} imageUpload
}
`,
UpdatePost: gql`
mutation($id: ID!, $title: String!, $content: String!, $language: String) {
UpdatePost(id: $id, title: $title, content: $content, language: $language) {
id
title
slug
content
contentExcerpt
language
} }
} }
`, `,

View File

@ -60,9 +60,9 @@
"apollo-client": "~2.6.3", "apollo-client": "~2.6.3",
"cookie-universal-nuxt": "~2.0.16", "cookie-universal-nuxt": "~2.0.16",
"cross-env": "~5.2.0", "cross-env": "~5.2.0",
"date-fns": "2.0.0-alpha.37", "date-fns": "2.0.0-beta.2",
"express": "~4.17.1", "express": "~4.17.1",
"graphql": "~14.3.1", "graphql": "~14.4.0",
"jsonwebtoken": "~8.5.1", "jsonwebtoken": "~8.5.1",
"linkify-it": "~2.1.0", "linkify-it": "~2.1.0",
"nuxt": "~2.8.1", "nuxt": "~2.8.1",
@ -91,7 +91,7 @@
"babel-eslint": "~10.0.2", "babel-eslint": "~10.0.2",
"babel-jest": "~24.8.0", "babel-jest": "~24.8.0",
"eslint": "~5.16.0", "eslint": "~5.16.0",
"eslint-config-prettier": "~5.0.0", "eslint-config-prettier": "~6.0.0",
"eslint-config-standard": "~12.0.0", "eslint-config-standard": "~12.0.0",
"eslint-loader": "~2.1.2", "eslint-loader": "~2.1.2",
"eslint-plugin-import": "~2.18.0", "eslint-plugin-import": "~2.18.0",

View File

@ -2,11 +2,13 @@ import { config, shallowMount, createLocalVue } from '@vue/test-utils'
import PostSlug from './index.vue' import PostSlug from './index.vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import Styleguide from '@human-connection/styleguide' import Styleguide from '@human-connection/styleguide'
import Filters from '~/plugins/vue-filters'
const localVue = createLocalVue() const localVue = createLocalVue()
localVue.use(Vuex) localVue.use(Vuex)
localVue.use(Styleguide) localVue.use(Styleguide)
localVue.use(Filters)
config.stubs['no-ssr'] = '<span><slot /></span>' config.stubs['no-ssr'] = '<span><slot /></span>'

View File

@ -2,7 +2,7 @@
<transition name="fade" appear> <transition name="fade" appear>
<ds-card <ds-card
v-if="post && ready" v-if="post && ready"
:image="post.image" :image="post.image | proxyApiUrl"
:class="{ 'post-card': true, 'disabled-content': post.disabled }" :class="{ 'post-card': true, 'disabled-content': post.disabled }"
> >
<ds-space margin-bottom="small" /> <ds-space margin-bottom="small" />

View File

@ -3,9 +3,7 @@
<ds-flex-item :width="{ base: '100%', md: 3 }"> <ds-flex-item :width="{ base: '100%', md: 3 }">
<hc-contribution-form /> <hc-contribution-form />
</ds-flex-item> </ds-flex-item>
<ds-flex-item :width="{ base: '100%', md: 1 }"> <ds-flex-item :width="{ base: '100%', md: 1 }">&nbsp;</ds-flex-item>
&nbsp;
</ds-flex-item>
</ds-flex> </ds-flex>
</template> </template>

View File

@ -10,7 +10,9 @@
:class="{ 'disabled-content': user.disabled }" :class="{ 'disabled-content': user.disabled }"
style="position: relative; height: auto;" style="position: relative; height: auto;"
> >
<hc-upload v-if="myProfile" :user="user" /> <hc-upload v-if="myProfile" :user="user">
<hc-avatar :user="user" class="profile-avatar" size="x-large"></hc-avatar>
</hc-upload>
<hc-avatar v-else :user="user" class="profile-avatar" size="x-large" /> <hc-avatar v-else :user="user" class="profile-avatar" size="x-large" />
<!-- Menu --> <!-- Menu -->
<no-ssr> <no-ssr>

View File

@ -3754,10 +3754,10 @@ data-urls@^1.0.0:
whatwg-mimetype "^2.2.0" whatwg-mimetype "^2.2.0"
whatwg-url "^7.0.0" whatwg-url "^7.0.0"
date-fns@2.0.0-alpha.37: date-fns@2.0.0-beta.2:
version "2.0.0-alpha.37" version "2.0.0-beta.2"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.37.tgz#c58b3e827da4f860ec8dc123e54019efb4a610e0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-beta.2.tgz#ccd556df832ef761baa88c600f53d2e829245999"
integrity sha512-fyIv/h6fkFd1u2NHXni5LPRPoa9FFh3hY67JSjNfa+k/u4EKvfrpGtoTM16Y/BJOqTb4W05UjcmwBna1ElyxDA== integrity sha512-4cicZF707RNerr3/Q3CcdLo+3OHMCfrRXE7h5iFgn7AMvX07sqKLxSf8Yp+WJW5bvKr2cy9/PkctXLv4iFtOaA==
date-now@^0.1.4: date-now@^0.1.4:
version "0.1.4" version "0.1.4"
@ -4236,10 +4236,10 @@ eslint-config-prettier@^3.3.0:
dependencies: dependencies:
get-stdin "^6.0.0" get-stdin "^6.0.0"
eslint-config-prettier@~5.0.0: eslint-config-prettier@~6.0.0:
version "5.0.0" version "6.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-5.0.0.tgz#f7a94b2b8ae7cbf25842c36fa96c6d32cd0a697c" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz#f429a53bde9fc7660e6353910fd996d6284d3c25"
integrity sha512-c17Aqiz5e8LEqoc/QPmYnaxQFAHTx2KlCZBPxXXjEMmNchOLnV/7j0HoPZuC+rL/tDC9bazUYOKJW9bOhftI/w== integrity sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA==
dependencies: dependencies:
get-stdin "^6.0.0" get-stdin "^6.0.0"
@ -5216,10 +5216,10 @@ graphql-upload@^8.0.2:
http-errors "^1.7.2" http-errors "^1.7.2"
object-path "^0.11.4" object-path "^0.11.4"
graphql@^14.1.1, graphql@~14.3.1: graphql@^14.1.1, graphql@~14.4.0:
version "14.3.1" version "14.4.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.3.1.tgz#b3aa50e61a841ada3c1f9ccda101c483f8e8c807" resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.4.0.tgz#e97086acfc0338e4fdc8f7dba519c6b8a6badfd9"
integrity sha512-FZm7kAa3FqKdXy8YSSpAoTtyDFMIYSpCDOr+3EqlI1bxmtHu+Vv/I2vrSeT1sBOEnEniX3uo4wFhFdS/8XN6gA== integrity sha512-E55z1oK6e4cGxCqlSsRWytYDPcIUxky3XkbuQUf6TIjCmn6C7CuBJpmkMF1066q95yPAGOZVPTVT7jABKbRFSA==
dependencies: dependencies:
iterall "^1.2.2" iterall "^1.2.2"

View File

@ -1832,10 +1832,10 @@ cypress-plugin-retries@^1.2.2:
resolved "https://registry.yarnpkg.com/cypress-plugin-retries/-/cypress-plugin-retries-1.2.2.tgz#7235371ca575ad9e16f883169e7f1588379f80f2" resolved "https://registry.yarnpkg.com/cypress-plugin-retries/-/cypress-plugin-retries-1.2.2.tgz#7235371ca575ad9e16f883169e7f1588379f80f2"
integrity sha512-+bVAqJAIwpFQbgM1mAdTgCXXhowEK0pF5DqhId2h0Wq+HQ+QQ2w3hspisVUPTY+HGvncMkddUQQGF5fATuaTvQ== integrity sha512-+bVAqJAIwpFQbgM1mAdTgCXXhowEK0pF5DqhId2h0Wq+HQ+QQ2w3hspisVUPTY+HGvncMkddUQQGF5fATuaTvQ==
cypress@^3.3.1: cypress@^3.3.2:
version "3.3.1" version "3.3.2"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.3.1.tgz#8a127b1d9fa74bff21f111705abfef58d595fdef" resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.3.2.tgz#105d9283c747884d534b88a8e6c857d977887024"
integrity sha512-JIo47ZD9P3jAw7oaK7YKUoODzszJbNw41JmBrlMMiupHOlhmXvZz75htuo7mfRFPC9/1MDQktO4lX/V2+a6lGQ== integrity sha512-d2gFX0KBBdNfMMZ/ud9ouNqjDtMM3Tf5Z50hkl8Ldb8T+jKc7RLFo/4FjMu9i28T2x+50Sx8sN/kLzxr2oeWNg==
dependencies: dependencies:
"@cypress/listr-verbose-renderer" "0.4.1" "@cypress/listr-verbose-renderer" "0.4.1"
"@cypress/xvfb" "1.2.4" "@cypress/xvfb" "1.2.4"
@ -1850,7 +1850,7 @@ cypress@^3.3.1:
execa "0.10.0" execa "0.10.0"
executable "4.1.1" executable "4.1.1"
extract-zip "1.6.7" extract-zip "1.6.7"
fs-extra "4.0.1" fs-extra "5.0.0"
getos "3.1.1" getos "3.1.1"
glob "7.1.3" glob "7.1.3"
is-ci "1.2.1" is-ci "1.2.1"
@ -2405,13 +2405,13 @@ fragment-cache@^0.2.1:
dependencies: dependencies:
map-cache "^0.2.2" map-cache "^0.2.2"
fs-extra@4.0.1: fs-extra@5.0.0:
version "4.0.1" version "5.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.1.tgz#7fc0c6c8957f983f57f306a24e5b9ddd8d0dd880" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd"
integrity sha1-f8DGyJV/mD9X8waiTlud3Y0N2IA= integrity sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==
dependencies: dependencies:
graceful-fs "^4.1.2" graceful-fs "^4.1.2"
jsonfile "^3.0.0" jsonfile "^4.0.0"
universalify "^0.1.0" universalify "^0.1.0"
fs-extra@7.0.0: fs-extra@7.0.0:
@ -3120,13 +3120,6 @@ json5@^0.5.0:
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=
jsonfile@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66"
integrity sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=
optionalDependencies:
graceful-fs "^4.1.6"
jsonfile@^4.0.0: jsonfile@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"