Skip to content
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

Autocomplete2 editor fixes #2189

Merged
merged 2 commits into from Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion root/static/scripts/common/components/Autocomplete2.js
Expand Up @@ -78,8 +78,12 @@ function doSearch<T: EntityItemT>(
});
});

const entityWebServicePath = state.entityType === 'editor'
? 'editor'
: ENTITIES[state.entityType].url;
Comment on lines +81 to +83
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, that's annoying. Maybe we should alias it to ws/js/user at some point.


const url = (
'/ws/js/' + ENTITIES[state.entityType].url +
'/ws/js/' + entityWebServicePath +
'/?q=' + encodeURIComponent(state.inputValue || '') +
'&page=' + String(state.page) +
'&direct=' + (state.indexedSearch ? 'false' : 'true')
Expand Down
Expand Up @@ -171,6 +171,11 @@ export function determineIfUserCanAddEntities<+T: EntityItemT>(
switch (state.entityType) {
case 'area':
return isLocationEditor(user);
case 'editor':
case 'genre':
case 'link_type':
case 'link_attribute_type':
return false;
case 'instrument':
return isRelationshipEditor(user);
default:
Expand Down
1 change: 1 addition & 0 deletions root/static/scripts/tests/autocomplete2.js
Expand Up @@ -144,6 +144,7 @@ $(function () {
>
<option value="area">{'Area'}</option>
<option value="artist">{'Artist'}</option>
<option value="editor">{'Editor'}</option>
<option value="event">{'Event'}</option>
<option value="instrument">{'Instrument'}</option>
<option value="label">{'Label'}</option>
Expand Down