Skip to content

Commit

Permalink
Merge pull request nextcloud#6583 from nextcloud/bugfix/noid/always-o…
Browse files Browse the repository at this point in the history
…pen-the-conversation-settings-with-the-right-data

Always open the conversation settings with the right data
  • Loading branch information
marcoambrosini authored Nov 22, 2021
2 parents 5111526 + d19a134 commit 7d30915
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ export default {
},

token() {
return this.$store.getters.getToken()
return this.$store.getters.getConversationSettingsToken()
|| this.$store.getters.getToken()
},

conversation() {
Expand Down Expand Up @@ -220,7 +221,8 @@ export default {
},

methods: {
handleShowSettings() {
handleShowSettings({ token }) {
this.$store.dispatch('updateConversationSettingsToken', token)
this.showSettings = true
this.$nextTick(() => {
this.$refs.linkShareSettings.focus()
Expand All @@ -229,6 +231,7 @@ export default {

handleHideSettings() {
this.showSettings = false
this.$store.dispatch('updateConversationSettingsToken', '')
},

beforeDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export default {
},

showConversationSettings() {
emit('show-conversation-settings')
emit('show-conversation-settings', { token: this.item.token })
},

/**
Expand Down
8 changes: 2 additions & 6 deletions src/components/TopBar/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<ActionButton
icon="icon-settings"
:close-after-click="true"
@click="showConversationSettings">
@click="openConversationSettings">
{{ t('spreed', 'Conversation settings') }}
</ActionButton>
</Actions>
Expand Down Expand Up @@ -408,10 +408,6 @@ export default {
BrowserStorage.setItem('sidebarOpen', 'true')
},

showConversationSettings() {
emit('show-conversation-settings')
},

fullScreenChanged() {
this.$store.dispatch(
'setIsFullscreen',
Expand Down Expand Up @@ -474,7 +470,7 @@ export default {
},

openConversationSettings() {
emit('show-conversation-settings')
emit('show-conversation-settings', { token: this.token })
},
},
}
Expand Down
24 changes: 24 additions & 0 deletions src/store/tokenStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

const state = {
token: '',
conversationSettingsToken: '',
fileIdForToken: null,
/**
* The joining of a room with the signaling server always lags
Expand All @@ -37,6 +38,9 @@ const getters = {
getToken: (state) => () => {
return state.token
},
getConversationSettingsToken: (state) => () => {
return state.conversationSettingsToken
},
getFileIdForToken: (state) => () => {
return state.fileIdForToken
},
Expand All @@ -56,6 +60,16 @@ const mutations = {
state.token = newToken
},

/**
* Updates the token of the conversation settings dialog
*
* @param {object} state current store state;
* @param {string} newToken The token of the active conversation
*/
updateConversationSettingsToken(state, newToken) {
state.conversationSettingsToken = newToken
},

/**
* Updates the file ID for the current token
*
Expand Down Expand Up @@ -86,6 +100,16 @@ const actions = {
context.commit('updateToken', newToken)
},

/**
* Updates the token
*
* @param {object} context default store context;
* @param {string} newToken The token of the active conversation
*/
updateConversationSettingsToken(context, newToken) {
context.commit('updateConversationSettingsToken', newToken)
},

/**
* Updates the file ID for the current token
*
Expand Down

0 comments on commit 7d30915

Please sign in to comment.