mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Don't chane the filterPostsMenu with state
@mattwr18 state is the root of all evil
This commit is contained in:
parent
cea206d118
commit
a8cfe96f60
@ -183,7 +183,6 @@ export default {
|
|||||||
isAdmin: 'auth/isAdmin',
|
isAdmin: 'auth/isAdmin',
|
||||||
quickSearchResults: 'search/quickResults',
|
quickSearchResults: 'search/quickResults',
|
||||||
quickSearchPending: 'search/quickPending',
|
quickSearchPending: 'search/quickPending',
|
||||||
showFilterPostsDropdown: 'default/showFilterPostsDropdown',
|
|
||||||
usersFollowedFilter: 'posts/usersFollowedFilter',
|
usersFollowedFilter: 'posts/usersFollowedFilter',
|
||||||
categoriesFilter: 'posts/categoriesFilter',
|
categoriesFilter: 'posts/categoriesFilter',
|
||||||
}),
|
}),
|
||||||
@ -223,6 +222,10 @@ export default {
|
|||||||
}
|
}
|
||||||
return routes
|
return routes
|
||||||
},
|
},
|
||||||
|
showFilterPostsDropdown() {
|
||||||
|
const [firstRoute] = this.$route.matched
|
||||||
|
return firstRoute.name === 'index'
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
Category(category) {
|
Category(category) {
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import Styleguide from '@human-connection/styleguide'
|
|||||||
import Filters from '~/plugins/vue-filters'
|
import Filters from '~/plugins/vue-filters'
|
||||||
import VTooltip from 'v-tooltip'
|
import VTooltip from 'v-tooltip'
|
||||||
import FilterMenu from '~/components/FilterMenu/FilterMenu'
|
import FilterMenu from '~/components/FilterMenu/FilterMenu'
|
||||||
import { mutations } from '~/store/default'
|
|
||||||
|
|
||||||
const localVue = createLocalVue()
|
const localVue = createLocalVue()
|
||||||
|
|
||||||
@ -44,9 +43,6 @@ describe('PostIndex', () => {
|
|||||||
'posts/usersFollowedFilter': () => {},
|
'posts/usersFollowedFilter': () => {},
|
||||||
'posts/categoriesFilter': () => {},
|
'posts/categoriesFilter': () => {},
|
||||||
},
|
},
|
||||||
mutations: {
|
|
||||||
'default/SET_SHOW_FILTER_POSTS_DROPDOWN': mutations.SET_SHOW_FILTER_POSTS_DROPDOWN,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: key => key,
|
$t: key => key,
|
||||||
|
|||||||
@ -92,14 +92,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.toggleShowFilterPostsDropdown(true)
|
|
||||||
if (this.hashtag) {
|
if (this.hashtag) {
|
||||||
this.changeFilterBubble({ tags_some: { name: this.hashtag } })
|
this.changeFilterBubble({ tags_some: { name: this.hashtag } })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
|
||||||
this.toggleShowFilterPostsDropdown(false)
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
Post(post) {
|
Post(post) {
|
||||||
this.setPosts(this.Post)
|
this.setPosts(this.Post)
|
||||||
@ -122,7 +118,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapMutations({
|
...mapMutations({
|
||||||
setPosts: 'posts/SET_POSTS',
|
setPosts: 'posts/SET_POSTS',
|
||||||
toggleShowFilterPostsDropdown: 'default/SET_SHOW_FILTER_POSTS_DROPDOWN',
|
|
||||||
}),
|
}),
|
||||||
changeFilterBubble(filter) {
|
changeFilterBubble(filter) {
|
||||||
if (this.hashtag) {
|
if (this.hashtag) {
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
export const state = () => {
|
|
||||||
return {
|
|
||||||
showFilterPostsDropdown: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getters = {
|
|
||||||
showFilterPostsDropdown(state) {
|
|
||||||
return state.showFilterPostsDropdown || false
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export const mutations = {
|
|
||||||
SET_SHOW_FILTER_POSTS_DROPDOWN(state, boolean) {
|
|
||||||
state.showFilterPostsDropdown = boolean || null
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user