-
-
Couldn't load subscription status.
- Fork 4.6k
fix(workflowengine): fix group not shown in Group membership check #52048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ import axios from '@nextcloud/axios' | |||||||||||||||||||||||||||||||||||||
| import NcSelect from '@nextcloud/vue/components/NcSelect' | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| const groups = [] | ||||||||||||||||||||||||||||||||||||||
| const wantedGroups = [] | ||||||||||||||||||||||||||||||||||||||
| const status = { | ||||||||||||||||||||||||||||||||||||||
| isLoading: false, | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -49,6 +50,7 @@ export default { | |||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||||
| groups, | ||||||||||||||||||||||||||||||||||||||
| status, | ||||||||||||||||||||||||||||||||||||||
| wantedGroups, | ||||||||||||||||||||||||||||||||||||||
| newValue: '', | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -82,6 +84,13 @@ export default { | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| searchAsync(searchQuery) { | ||||||||||||||||||||||||||||||||||||||
| if (this.status.isLoading) { | ||||||||||||||||||||||||||||||||||||||
| if (searchQuery) { | ||||||||||||||||||||||||||||||||||||||
| // The first 20 groups are loaded up front (indicated by an | ||||||||||||||||||||||||||||||||||||||
| // empty searchQuery parameter), afterwards we may load | ||||||||||||||||||||||||||||||||||||||
| // groups that have not been fetched yet, but are used | ||||||||||||||||||||||||||||||||||||||
| // in existing rules. | ||||||||||||||||||||||||||||||||||||||
| this.enqueueWantedGroup(searchQuery) | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -94,11 +103,15 @@ export default { | |||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||
| this.status.isLoading = false | ||||||||||||||||||||||||||||||||||||||
| this.findGroupByQueue() | ||||||||||||||||||||||||||||||||||||||
| }, (error) => { | ||||||||||||||||||||||||||||||||||||||
| console.error('Error while loading group list', error.response) | ||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| updateInternalValue() { | ||||||||||||||||||||||||||||||||||||||
| async updateInternalValue() { | ||||||||||||||||||||||||||||||||||||||
| if (!this.newValue) { | ||||||||||||||||||||||||||||||||||||||
| await this.searchAsync(this.modelValue) | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| this.newValue = this.modelValue | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| addGroup(group) { | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -107,10 +120,32 @@ export default { | |||||||||||||||||||||||||||||||||||||
| this.groups.push(group) | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| hasGroup(group) { | ||||||||||||||||||||||||||||||||||||||
| const index = this.groups.findIndex((item) => item.id === group) | ||||||||||||||||||||||||||||||||||||||
| return index > -1 | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| update(value) { | ||||||||||||||||||||||||||||||||||||||
| this.newValue = value.id | ||||||||||||||||||||||||||||||||||||||
| this.$emit('update:model-value', this.newValue) | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| enqueueWantedGroup(expectedGroupId) { | ||||||||||||||||||||||||||||||||||||||
| const index = this.wantedGroups.findIndex((groupId) => groupId === expectedGroupId) | ||||||||||||||||||||||||||||||||||||||
| if (index === -1) { | ||||||||||||||||||||||||||||||||||||||
| this.wantedGroups.push(expectedGroupId) | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| async findGroupByQueue() { | ||||||||||||||||||||||||||||||||||||||
| let nextQuery | ||||||||||||||||||||||||||||||||||||||
| do { | ||||||||||||||||||||||||||||||||||||||
| nextQuery = this.wantedGroups.shift() | ||||||||||||||||||||||||||||||||||||||
| if (this.hasGroup(nextQuery)) { | ||||||||||||||||||||||||||||||||||||||
| nextQuery = undefined | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| } while (!nextQuery && this.wantedGroups.length > 0) | ||||||||||||||||||||||||||||||||||||||
| if (nextQuery) { | ||||||||||||||||||||||||||||||||||||||
| await this.searchAsync(nextQuery) | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+138
to
+147
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Easier to read.
Suggested change
Also, the current implementation would only search 1 wanted group, I assuming this intended as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was intentionally done as a queue in order to not DoS the server with group search requests, but have them coming sequentially. |
||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| </script> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.