aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/src
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-12-23 10:25:42 +0100
committerJulius Härtl <jus@bitgrid.net>2019-12-27 08:45:38 +0100
commitb8779eed3680be88155750e2564465c462007f54 (patch)
treefbc89c5e97a7b3fc704dfac9ac2e221c15603f4c /apps/workflowengine/src
parenta0d786769d99b946928094eb2c7db9d6bf9b4a1c (diff)
downloadnextcloud-server-b8779eed3680be88155750e2564465c462007f54.tar.gz
nextcloud-server-b8779eed3680be88155750e2564465c462007f54.zip
Allow selecting other event types (fix #18510)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/workflowengine/src')
-rw-r--r--apps/workflowengine/src/components/Event.vue16
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)
},
},