Move message history limit handling to ChatBox
This commit is contained in:
parent
9c0213016b
commit
1615c3d902
@ -34,7 +34,14 @@
|
|||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore(),
|
const store = useStore(),
|
||||||
messages = computed(() => store.state.chat.messages);
|
componentSettings = computed(() => store.state.components.chatBox),
|
||||||
|
messages = computed(() => {
|
||||||
|
if(componentSettings.value!.messageHistory) {
|
||||||
|
return store.state.chat.messages.slice(componentSettings.value!.messageHistory);
|
||||||
|
} else {
|
||||||
|
return store.state.chat.messages;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
messages,
|
messages,
|
||||||
|
@ -242,10 +242,6 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
//Adds chat messages from an update fetch to the chat history
|
//Adds chat messages from an update fetch to the chat history
|
||||||
[MutationTypes.ADD_CHAT](state: State, chat: Array<DynmapChat>) {
|
[MutationTypes.ADD_CHAT](state: State, chat: Array<DynmapChat>) {
|
||||||
state.chat.messages.unshift(...chat);
|
state.chat.messages.unshift(...chat);
|
||||||
|
|
||||||
if(state.components.chatBox && isFinite(state.components.chatBox.messageHistory)) {
|
|
||||||
state.chat.messages.splice(state.components.chatBox.messageHistory);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//Pops the specified number of marker updates from the pending updates list
|
//Pops the specified number of marker updates from the pending updates list
|
||||||
|
Loading…
Reference in New Issue
Block a user