diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-02-03 15:33:04 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-02-03 15:33:04 +0300 |
commit | de19e51b8f5b1f641184f33a20984ad0567489a9 (patch) | |
tree | 5a4331c2cf5a94b63a2c9fd07403b85d3f575f8c | |
parent | 4fe627faea69fb99882a2cf6d6ce9800f5795092 (diff) |
Fix new conversation dialog when no item is selected
"showModal()" was being called as the handler for the on-click event and
the EventBus.$on('NewGroupConversationDialog'). As the first one always
provides the event as the first parameter the item was always defined,
but it never contained a label, so the model became undefined and thus
the dialog failed to open.
Now the method was split in two, one to be used to just show the modal
and another one that also takes into account the item being given.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue b/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue index c74acdc66..6c1b828df 100644 --- a/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue +++ b/src/components/LeftSidebar/NewGroupConversation/NewGroupConversation.vue @@ -204,21 +204,26 @@ export default { }, mounted() { - EventBus.$on('NewGroupConversationDialog', this.showModal) + EventBus.$on('NewGroupConversationDialog', this.showModalForItem) }, destroyed() { - EventBus.$off('NewGroupConversationDialog', this.showModal) + EventBus.$off('NewGroupConversationDialog', this.showModalForItem) }, methods: { - showModal(item) { + showModal() { + this.modal = true + }, + + showModalForItem(item) { if (item) { // Preload the conversation name from group selection this.conversationNameInput = item.label this.$store.dispatch('updateSelectedParticipants', item) } - this.modal = true + + this.showModal() }, /** Reinitialise the component to it's initial state. This is necessary * because once the component is mounted it's data would persist even if |