Merge branch 'master' of github.com:Human-Connection/Human-Connection into 1352-fix-update-post-resolver

This commit is contained in:
Matt Rider 2019-08-23 12:19:19 +02:00
commit 8555148e53
15 changed files with 864 additions and 945 deletions

View File

@ -61,7 +61,7 @@
"dotenv": "~8.1.0",
"express": "^4.17.1",
"faker": "Marak/faker.js#master",
"graphql": "~14.4.2",
"graphql": "^14.5.0",
"graphql-custom-directives": "~0.2.14",
"graphql-iso-date": "~3.6.1",
"graphql-middleware": "~3.0.5",
@ -118,7 +118,7 @@
"cucumber": "~5.1.0",
"eslint": "~6.2.1",
"eslint-config-prettier": "~6.1.0",
"eslint-config-standard": "~14.0.0",
"eslint-config-standard": "~14.0.1",
"eslint-plugin-import": "~2.18.2",
"eslint-plugin-jest": "~22.15.2",
"eslint-plugin-node": "~9.1.0",

View File

@ -4,7 +4,7 @@ import CONFIG from './../config'
// Generate an Access Token for the given User ID
export default function encode(user) {
const token = jwt.sign(user, CONFIG.JWT_SECRET, {
expiresIn: 24 * 60 * 60 * 1000, // one day
expiresIn: '1d',
issuer: CONFIG.GRAPHQL_URI,
audience: CONFIG.CLIENT_URI,
subject: user.id.toString(),

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
"codecov": "^3.5.0",
"cross-env": "^5.2.0",
"cypress": "^3.4.1",
"cypress-cucumber-preprocessor": "^1.14.0",
"cypress-cucumber-preprocessor": "^1.14.1",
"cypress-file-upload": "^3.3.3",
"cypress-plugin-retries": "^1.2.2",
"dotenv": "^8.1.0",

View File

@ -54,6 +54,7 @@ describe('FilterPosts.vue', () => {
'postsFilter/TOGGLE_CATEGORY': jest.fn(),
}
getters = {
'postsFilter/isActive': () => false,
'auth/user': () => {
return { id: 'u34' }
},
@ -63,7 +64,7 @@ describe('FilterPosts.vue', () => {
const openFilterPosts = () => {
const store = new Vuex.Store({ mutations, getters })
const wrapper = mount(FilterPosts, { mocks, localVue, propsData, store })
menuToggle = wrapper.findAll('a').at(0)
menuToggle = wrapper.findAll('button').at(0)
menuToggle.trigger('click')
return wrapper
}
@ -81,13 +82,13 @@ describe('FilterPosts.vue', () => {
it('starts with all categories button active', () => {
const wrapper = openFilterPosts()
allCategoriesButton = wrapper.findAll('button').at(0)
allCategoriesButton = wrapper.findAll('button').at(1)
expect(allCategoriesButton.attributes().class).toContain('ds-button-primary')
})
it('calls TOGGLE_CATEGORY when clicked', () => {
const wrapper = openFilterPosts()
environmentAndNatureButton = wrapper.findAll('button').at(1)
environmentAndNatureButton = wrapper.findAll('button').at(2)
environmentAndNatureButton.trigger('click')
expect(mutations['postsFilter/TOGGLE_CATEGORY']).toHaveBeenCalledWith({}, 'cat4')
})
@ -95,7 +96,7 @@ describe('FilterPosts.vue', () => {
it('sets category button attribute `primary` when corresponding category is filtered', () => {
getters['postsFilter/filteredCategoryIds'] = jest.fn(() => ['cat9'])
const wrapper = openFilterPosts()
democracyAndPoliticsButton = wrapper.findAll('button').at(3)
democracyAndPoliticsButton = wrapper.findAll('button').at(4)
expect(democracyAndPoliticsButton.attributes().class).toContain('ds-button-primary')
})

View File

@ -1,9 +1,15 @@
<template>
<dropdown ref="menu" :placement="placement" :offset="offset">
<a slot="default" slot-scope="{ toggleMenu }" href="#" @click.prevent="toggleMenu()">
<ds-icon style="margin: 12px 0px 0px 10px;" name="filter" size="large" />
<ds-icon style="margin: 7px 0px 0px 2px" size="xx-small" name="angle-down" />
</a>
<ds-button
slot="default"
icon="filter"
:primary="filterActive"
:ghost="!filterActive"
slot-scope="{ toggleMenu }"
@click.prevent="toggleMenu()"
>
<ds-icon size="xx-small" name="angle-down" />
</ds-button>
<template slot="popover">
<filter-posts-menu-items :chunk="chunk" :user="currentUser" />
</template>
@ -28,6 +34,7 @@ export default {
computed: {
...mapGetters({
currentUser: 'auth/user',
filterActive: 'postsFilter/isActive',
}),
chunk() {
return _.chunk(this.categories, 2)

View File

@ -24,6 +24,7 @@ export default i18n => {
badgesCount
shoutedCount
commentedCount
contributionsCount
followingCount
following(first: 7) {
id

View File

@ -3,7 +3,7 @@
<div class="main-navigation">
<ds-container class="main-navigation-container" style="padding: 10px 10px;">
<div>
<ds-flex class="main-navigation-flex">
<ds-flex class="main-navigation-flex" centered>
<ds-flex-item :width="{ lg: '3.5%' }" />
<ds-flex-item :width="{ base: '80%', sm: '80%', md: '80%', lg: '15%' }">
<a @click="redirectToRoot">
@ -293,6 +293,11 @@ export default {
padding-top: 6rem;
padding-bottom: 5rem;
}
.main-navigation-flex {
align-items: center;
}
.main-navigation {
a {
color: $text-color-soft;

View File

@ -271,7 +271,7 @@ module.exports = {
apollo: {
tokenName: 'human-connection-token', // optional, default: apollo-token
cookieAttributes: {
expires: 3, // optional, default: 7 (days)
expires: 1, // optional, default: 7 (days)
},
// includeNodeModules: true, // optional, default: false (this includes graphql-tag for node_modules folder)

View File

@ -63,7 +63,7 @@
"cross-env": "~5.2.0",
"date-fns": "2.0.0",
"express": "~4.17.1",
"graphql": "~14.4.2",
"graphql": "~14.5.0",
"isemail": "^3.2.0",
"jsonwebtoken": "~8.5.1",
"linkify-it": "~2.2.0",
@ -78,7 +78,7 @@
"v-tooltip": "~2.0.2",
"vue-count-to": "~1.0.13",
"vue-infinite-scroll": "^2.0.2",
"vue-izitoast": "roschaefer/vue-izitoast#patch-1",
"vue-izitoast": "^1.2.0",
"vue-sweetalert-icons": "~4.2.0",
"vuex-i18n": "~1.13.1",
"zxcvbn": "^4.4.2"

View File

@ -144,10 +144,4 @@ export const actions = {
commit('SET_TOKEN', null)
return this.app.$apolloHelpers.onLogout()
},
register({ dispatch, commit }, { email, password, inviteCode, invitedByUserId }) {},
async patch({ state, commit, dispatch }, data) {},
resendVerifySignup({ state, dispatch }) {},
resetPassword({ state }, data) {},
setNewPassword({ state }, data) {},
}

View File

@ -2,11 +2,16 @@ import get from 'lodash/get'
import update from 'lodash/update'
import xor from 'lodash/xor'
import isEmpty from 'lodash/isEmpty'
import isEqual from 'lodash/isEqual'
import clone from 'lodash/clone'
const defaultFilter = {}
export const state = () => {
return {
filter: {},
filter: {
...defaultFilter,
},
}
}
@ -38,6 +43,9 @@ export const mutations = {
}
export const getters = {
isActive(state) {
return !isEqual(state.filter, defaultFilter)
},
postsFilter(state) {
return state.filter
},

View File

@ -4,6 +4,15 @@ let state
let testAction
describe('getters', () => {
describe('isActive', () => {
it('returns true if filter differs from default setting', () => {
state = { filter: {} }
expect(getters.isActive(state)).toEqual(false)
state = { filter: { categories_some: { id_in: [24] } } }
expect(getters.isActive(state)).toEqual(true)
})
})
describe('filteredCategoryIds', () => {
it('returns category ids if filter is set', () => {
state = { filter: { categories_some: { id_in: [24] } } }

View File

@ -7624,10 +7624,10 @@ graphql-upload@^8.0.2:
http-errors "^1.7.2"
object-path "^0.11.4"
"graphql@14.0.2 - 14.2.0 || ^14.3.1", graphql@^14.4.0, graphql@~14.4.2:
version "14.4.2"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.4.2.tgz#553a7d546d524663eda49ed6df77577be3203ae3"
integrity sha512-6uQadiRgnpnSS56hdZUSvFrVcQ6OF9y6wkxJfKquFtHlnl7+KSuWwSJsdwiK1vybm1HgcdbpGkCpvhvsVQ0UZQ==
"graphql@14.0.2 - 14.2.0 || ^14.3.1", graphql@^14.4.0, graphql@~14.5.0:
version "14.5.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.5.0.tgz#4801e6460942c9c591944617f6dd224a9e531520"
integrity sha512-wnGcTD181L2xPnIwHHjx/moV4ulxA2Kms9zcUY+B/SIrK+2N+iOC6WNgnR2zVTmg1Z8P+CZq5KXibTnatg3WUw==
dependencies:
iterall "^1.2.2"
@ -8851,7 +8851,7 @@ iterall@^1.1.3, iterall@^1.2.1, iterall@^1.2.2:
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7"
integrity sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==
izitoast@^1.3.0:
izitoast@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/izitoast/-/izitoast-1.4.0.tgz#1aa4e3408b7159fba743506af66d8be54fd929fb"
integrity sha512-Oc1X2wiQtPp39i5VpIjf3GJf5sfCtHKXZ5szx7RareyEeFLUlcEW0FSfBni28+Ul6KNKZRKzhVuWzSP4Xngh0w==
@ -15159,11 +15159,12 @@ vue-infinite-scroll@^2.0.2:
resolved "https://registry.yarnpkg.com/vue-infinite-scroll/-/vue-infinite-scroll-2.0.2.tgz#ca37a91fe92ee0ad3b74acf8682c00917144b711"
integrity sha512-n+YghR059YmciANGJh9SsNWRi1YZEBVlODtmnb/12zI+4R72QZSWd+EuZ5mW6auEo/yaJXgxzwsuhvALVnm73A==
vue-izitoast@roschaefer/vue-izitoast#patch-1:
version "1.1.2"
resolved "https://codeload.github.com/roschaefer/vue-izitoast/tar.gz/ba6b03eb24c7c04c299e64a9703e101bf158ae50"
vue-izitoast@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/vue-izitoast/-/vue-izitoast-1.2.0.tgz#55b7434a391c6eb64dd10c0de211e99ba7e486e2"
integrity sha512-Jqxfid12SUBIySJxgyPpu6gZ1ssMcbKtCvu9uMQPNM8RUnd3RKC4nyxkncdYe5L6XPU+SaznjYRudnvtclY4wA==
dependencies:
izitoast "^1.3.0"
izitoast "^1.4.0"
vue-jest@~3.0.4:
version "3.0.4"

View File

@ -1847,10 +1847,10 @@ cucumber@^4.2.1:
util-arity "^1.0.2"
verror "^1.9.0"
cypress-cucumber-preprocessor@^1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/cypress-cucumber-preprocessor/-/cypress-cucumber-preprocessor-1.14.0.tgz#79fa9d4da72e2cb56bf511c17c77f8200b3279f1"
integrity sha512-eo79d7XCX4JG5wWGQJ2tuONTEgQfZHNGvuBMwTNjvZcz+qEVy04kdiBzbQGB7uy2Lf9LAkabt1hKUjwewmMioA==
cypress-cucumber-preprocessor@^1.14.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/cypress-cucumber-preprocessor/-/cypress-cucumber-preprocessor-1.14.1.tgz#47a6ddd28ca1b0a4ec24707b20ca5c0d7ffc7875"
integrity sha512-72RN3sUeq0r4aNiFfztQD6Uvi58fifkfc2R4pCyX6oTEZLfHfcudkNQLd98ByCyiWXNXPHlGGihE6+EPCDK59A==
dependencies:
"@cypress/browserify-preprocessor" "^1.1.2"
chai "^4.1.2"