diff --git a/front/src/App.vue b/front/src/App.vue index 6d83b2b..081c3b7 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -117,10 +117,20 @@ export default { break case 'update_message': - this.$store.commit('editMessage', { - mid: event.message_id, - content: event.rendered_content - }) + if ( + event.message_ids.length > 1 && + 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 case 'reaction': diff --git a/front/src/store/index.js b/front/src/store/index.js index 528bc3a..91582e1 100644 --- a/front/src/store/index.js +++ b/front/src/store/index.js @@ -184,10 +184,17 @@ export default createStore({ id: mid, content: content, }, state.currentStream)]] 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: { @@ -195,7 +202,11 @@ export default createStore({ getters: { 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) + ) } })