diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-12-27 14:29:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-27 14:29:09 +0100 |
commit | f3232fc192ed119705685516f447589c79bfde6e (patch) | |
tree | 41d1c98b69ba8ba4aba7baf39b73e11727dfd2e7 /apps/workflowengine/src/components/Event.vue | |
parent | 060b6d30eea83ea9be29372398eb85e985862c49 (diff) | |
parent | b2ba561db3e87919d3ceb8f03aed150d5f5c616a (diff) | |
download | nextcloud-server-f3232fc192ed119705685516f447589c79bfde6e.tar.gz nextcloud-server-f3232fc192ed119705685516f447589c79bfde6e.zip |
Merge pull request #18547 from nextcloud/bugfix/flow
Various flow related fixes
Diffstat (limited to 'apps/workflowengine/src/components/Event.vue')
-rw-r--r-- | apps/workflowengine/src/components/Event.vue | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/workflowengine/src/components/Event.vue b/apps/workflowengine/src/components/Event.vue index 9883a8cf93c..bf8e06e5df1 100644 --- a/apps/workflowengine/src/components/Event.vue +++ b/apps/workflowengine/src/components/Event.vue @@ -56,7 +56,21 @@ export default { }, methods: { updateEvent(events) { - this.$set(this.rule, 'events', events.map(event => event.eventName)) + if (events.length === 0) { + window.OCP.Toast.warning(t('workflowengine', 'At least one event must be selected')) + return + } + const existingEntity = this.rule.entity + const newEntities = events.map(event => event.entity.id).filter((value, index, self) => self.indexOf(value) === index) + let newEntity = null + if (newEntities.length > 1) { + newEntity = newEntities.filter(entity => entity !== existingEntity)[0] + } else { + newEntity = newEntities[0] + } + + this.$set(this.rule, 'entity', newEntity) + this.$set(this.rule, 'events', events.filter(event => event.entity.id === newEntity).map(event => event.eventName)) this.$emit('update', this.rule) }, }, |