topic adding / removing / updating nnowin real-time
This commit is contained in:
parent
78dce918eb
commit
268623ad2a
2 changed files with 27 additions and 6 deletions
|
|
@ -117,10 +117,20 @@ export default {
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'update_message':
|
case 'update_message':
|
||||||
this.$store.commit('editMessage', {
|
if (
|
||||||
mid: event.message_id,
|
event.message_ids.length > 1 &&
|
||||||
content: event.rendered_content
|
event.orig_subject
|
||||||
})
|
){
|
||||||
|
this.$store.commit('updateTopic', {
|
||||||
|
orig_subject: event.orig_subject,
|
||||||
|
subject: event.subject
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$store.commit('editMessage', {
|
||||||
|
mid: event.message_id,
|
||||||
|
content: event.rendered_content
|
||||||
|
})
|
||||||
|
}
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'reaction':
|
case 'reaction':
|
||||||
|
|
|
||||||
|
|
@ -184,10 +184,17 @@ export default createStore({
|
||||||
id: mid, content: content,
|
id: mid, content: content,
|
||||||
}, state.currentStream)]]
|
}, state.currentStream)]]
|
||||||
state.rules = newRules
|
state.rules = newRules
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateTopic: (state, { orig_subject, subject }) => {
|
||||||
|
const topic = state.topics.find(t => t.title == orig_subject)
|
||||||
|
if (topic) {
|
||||||
|
topic.title = subject
|
||||||
|
topic.messages.forEach(m => m.subject = subject)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -195,7 +202,11 @@ export default createStore({
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
rules: state => state.rules,
|
rules: state => state.rules,
|
||||||
sortedTopics: state => [...state.topics].sort((a, b) => a.title.localeCompare(b.title))
|
sortedTopics: state => (
|
||||||
|
[...state.topics]
|
||||||
|
.sort((a, b) => a.title.localeCompare(b.title))
|
||||||
|
.filter(t => t.messages.length > 0)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue