Move statusHistory module to store
This commit is contained in:
parent
c25cfe540b
commit
872569ae8e
|
@ -17,6 +17,7 @@ import {
|
||||||
faFlag
|
faFlag
|
||||||
} from '@fortawesome/free-regular-svg-icons'
|
} from '@fortawesome/free-regular-svg-icons'
|
||||||
import { useEditStatusStore } from '../../stores/editStatus'
|
import { useEditStatusStore } from '../../stores/editStatus'
|
||||||
|
import { useStatusHistoryStore } from '../../stores/statusHistory'
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
faEllipsisH,
|
faEllipsisH,
|
||||||
|
@ -123,7 +124,7 @@ const ExtraButtons = {
|
||||||
const originalStatus = { ...this.status }
|
const originalStatus = { ...this.status }
|
||||||
const stripFieldsList = ['attachments', 'created_at', 'emojis', 'text', 'raw_html', 'nsfw', 'poll', 'summary', 'summary_raw_html']
|
const stripFieldsList = ['attachments', 'created_at', 'emojis', 'text', 'raw_html', 'nsfw', 'poll', 'summary', 'summary_raw_html']
|
||||||
stripFieldsList.forEach(p => delete originalStatus[p])
|
stripFieldsList.forEach(p => delete originalStatus[p])
|
||||||
this.$store.dispatch('openStatusHistoryModal', originalStatus)
|
useStatusHistoryStore().openStatusHistoryModal(originalStatus)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { get } from 'lodash'
|
import { get } from 'lodash'
|
||||||
import Modal from '../modal/modal.vue'
|
import Modal from '../modal/modal.vue'
|
||||||
import Status from '../status/status.vue'
|
import Status from '../status/status.vue'
|
||||||
|
import { useStatusHistoryStore } from '../../stores/statusHistory'
|
||||||
|
|
||||||
const StatusHistoryModal = {
|
const StatusHistoryModal = {
|
||||||
components: {
|
components: {
|
||||||
|
@ -14,10 +15,10 @@ const StatusHistoryModal = {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
modalActivated () {
|
modalActivated () {
|
||||||
return this.$store.state.statusHistory.modalActivated
|
return useStatusHistoryStore().modalActivated
|
||||||
},
|
},
|
||||||
params () {
|
params () {
|
||||||
return this.$store.state.statusHistory.params
|
return useStatusHistoryStore().params
|
||||||
},
|
},
|
||||||
statusId () {
|
statusId () {
|
||||||
return this.params.id
|
return this.params.id
|
||||||
|
@ -52,7 +53,7 @@ const StatusHistoryModal = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
closeModal () {
|
closeModal () {
|
||||||
this.$store.dispatch('closeStatusHistoryModal')
|
useStatusHistoryStore().closeStatusHistoryModal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import authFlowModule from './modules/auth_flow.js'
|
||||||
import oauthTokensModule from './modules/oauth_tokens.js'
|
import oauthTokensModule from './modules/oauth_tokens.js'
|
||||||
import reportsModule from './modules/reports.js'
|
import reportsModule from './modules/reports.js'
|
||||||
import pollsModule from './modules/polls.js'
|
import pollsModule from './modules/polls.js'
|
||||||
import statusHistoryModule from './modules/statusHistory.js'
|
|
||||||
|
|
||||||
import chatsModule from './modules/chats.js'
|
import chatsModule from './modules/chats.js'
|
||||||
import announcementsModule from './modules/announcements.js'
|
import announcementsModule from './modules/announcements.js'
|
||||||
|
@ -80,7 +79,6 @@ const persistedStateOptions = {
|
||||||
oauthTokens: oauthTokensModule,
|
oauthTokens: oauthTokensModule,
|
||||||
reports: reportsModule,
|
reports: reportsModule,
|
||||||
polls: pollsModule,
|
polls: pollsModule,
|
||||||
statusHistory: statusHistoryModule,
|
|
||||||
chats: chatsModule,
|
chats: chatsModule,
|
||||||
announcements: announcementsModule
|
announcements: announcementsModule
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
const statusHistory = {
|
|
||||||
state: {
|
|
||||||
params: {},
|
|
||||||
modalActivated: false
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
openStatusHistoryModal (state, params) {
|
|
||||||
state.params = params
|
|
||||||
state.modalActivated = true
|
|
||||||
},
|
|
||||||
closeStatusHistoryModal (state) {
|
|
||||||
state.modalActivated = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
openStatusHistoryModal ({ commit }, params) {
|
|
||||||
commit('openStatusHistoryModal', params)
|
|
||||||
},
|
|
||||||
closeStatusHistoryModal ({ commit }) {
|
|
||||||
commit('closeStatusHistoryModal')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default statusHistory
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
|
export const useStatusHistoryStore = defineStore('statusHistory', {
|
||||||
|
state: () => ({
|
||||||
|
params: {},
|
||||||
|
modalActivated: false
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
openStatusHistoryModal (params) {
|
||||||
|
this.params = params
|
||||||
|
this.modalActivated = true
|
||||||
|
},
|
||||||
|
closeStatusHistoryModal () {
|
||||||
|
this.modalActivated = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
Loading…
Reference in New Issue