Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
fix: also delete global options when removing a plugin (#1816)
Browse files Browse the repository at this point in the history
  • Loading branch information
dated authored Mar 16, 2020
1 parent b09368a commit df07fa0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export default {
computed: {
hasStorage () {
return this.plugin.permissions.includes('STORAGE') && this.$store.getters['plugin/profileHasPluginOptions'](this.plugin.id)
return this.plugin.permissions.includes('STORAGE') &&
(
this.$store.getters['plugin/profileHasPluginOptions'](this.plugin.id) ||
this.$store.getters['plugin/profileHasPluginOptions'](this.plugin.id, 'global')
)
}
},
Expand Down
8 changes: 8 additions & 0 deletions src/renderer/store/modules/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ export default {
DELETE_PLUGIN_OPTIONS (state, { pluginId, profileId }) {
if (state.pluginOptions[profileId] && state.pluginOptions[profileId][pluginId]) {
Vue.delete(state.pluginOptions[profileId], pluginId)

if (!Object.keys(state.pluginOptions[profileId]).length) {
Vue.delete(state.pluginOptions, profileId)
}
}
},

Expand Down Expand Up @@ -475,6 +479,10 @@ export default {
}
}

if (removeOptions && getters.profileHasPluginOptions(pluginId, 'global')) {
dispatch('deletePluginOptionsForProfile', { pluginId, profileId: 'global' })
}

try {
await this._vm.$plugins.deletePlugin(pluginId)
} catch (error) {
Expand Down

0 comments on commit df07fa0

Please sign in to comment.