Filter default sites for items user setting #2167
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt to resolve a conflict between the "assign_new_items" site setting and the "can-assign-items" user permission. Put simply, a site can be set to automatically assign itself to new items, but the user can lack the permission to assign items to the site. This conflict could lead to a broken "Site" tab on the item add page (see #2166).
This PR fixes the conflict by a) limiting the sites on the site selector sidebar to those that the current user has "can-assign-items" permission; and b) adding the sites that are "assign_new_items" but restricted by "can-assign-items" to the "Site" tab, giving users the opportunity to assign these restricted sites, but only on the item add page. A few other changes to the site selector element, the item adapter, and JS were necessary to accomplish this.