refs #2258 Apply filter to thread

This commit is contained in:
AkiraFukushima 2021-05-22 14:45:09 +09:00
parent c4395dd536
commit 968921b8fd
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
2 changed files with 16 additions and 5 deletions

View File

@ -5,6 +5,7 @@
:message="message"
:focused="message.uri + message.id === focusedId"
:overlaid="modalOpened"
:filters="filters"
v-on:update="updateAncestorsToot"
v-on:delete="deleteAncestorsToot"
@focusNext="focusNext"
@ -19,6 +20,7 @@
:message="message"
:focused="message.uri + message.id === focusedId"
:overlaid="modalOpened"
:filters="filters"
:detailed="true"
v-on:update="updateToot"
v-on:delete="deleteToot"
@ -34,6 +36,7 @@
:message="message"
:focused="message.uri + message.id === focusedId"
:overlaid="modalOpened"
:filters="filters"
v-on:update="updateDescendantsToot"
v-on:delete="deleteDescendantsToot"
@focusNext="focusNext"
@ -66,6 +69,7 @@ export default {
descendants: state => state.descendants,
timeline: state => state.ancestors.concat([state.message]).concat(state.descendants)
}),
...mapGetters('TimelineSpace/Contents/SideBar/TootDetail', ['filters']),
...mapGetters('TimelineSpace/Modals', ['modalOpened'])
},
created() {
@ -74,13 +78,13 @@ export default {
mounted() {
Event.$on('focus-sidebar', () => {
this.focusedId = 0
this.$nextTick(function() {
this.$nextTick(function () {
this.focusedId = this.timeline[0].uri + this.timeline[0].id
})
})
},
watch: {
message: function() {
message: function () {
this.load()
}
},

View File

@ -1,5 +1,5 @@
import generator, { Entity } from 'megalodon'
import { Module, MutationTree, ActionTree } from 'vuex'
import generator, { Entity, FilterContext } from 'megalodon'
import { Module, MutationTree, ActionTree, GetterTree } from 'vuex'
import { RootState } from '@/store'
export type TootDetailState = {
@ -136,11 +136,18 @@ const actions: ActionTree<TootDetailState, RootState> = {
}
}
const getters: GetterTree<TootDetailState, RootState> = {
filters: (_state, _getters, rootState) => {
return rootState.TimelineSpace.filters.filter(f => f.context.includes(FilterContext.Thread) && !f.irreversible)
}
}
const TootDetail: Module<TootDetailState, RootState> = {
namespaced: true,
state: state,
mutations: mutations,
actions: actions
actions: actions,
getters: getters
}
export default TootDetail