Fix issue with duplicate author search keywords
This commit is contained in:
parent
cda7675aef
commit
bc8937daa6
2
js/application.min.js
vendored
2
js/application.min.js
vendored
File diff suppressed because one or more lines are too long
8
js/complete.min.js
vendored
8
js/complete.min.js
vendored
File diff suppressed because one or more lines are too long
@ -91,7 +91,9 @@ if ( $show_advanced ) {
|
||||
|
||||
if ( ! $skip_author_keywords ) {
|
||||
foreach ( $all_authors as $author ) {
|
||||
$allow_list[ rawurlencode( strtolower( $author->display_name ) ) ] = $author->ID;
|
||||
$author_key = rawurlencode( strtolower( $author->display_name ) );
|
||||
|
||||
$allow_list[ $author_key . '_' . $author->ID ] = $author->ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1698,10 +1698,15 @@ class FCN_KeywordInput {
|
||||
this.noHint.hidden = !(value != '' && count < 1);
|
||||
}
|
||||
|
||||
addNode(text = null) {
|
||||
addNode(text = null, trigger = null) {
|
||||
// Get and prepare value
|
||||
const name = text ?? this.input.value.replace(',', '');
|
||||
const value = this.allowList[this.encode(name)];
|
||||
let value = this.allowList[this.encode(name)];
|
||||
|
||||
// Author names can be duplicates
|
||||
if (this.collection.name == 'authors' && trigger) {
|
||||
value = this.allowList[this.encode(name) + '_' + trigger.value];
|
||||
}
|
||||
|
||||
// Only allowed value and no duplicates
|
||||
if (!value || this.keywords.indexOf(value) > -1) {
|
||||
@ -1866,7 +1871,7 @@ class FCN_KeywordInput {
|
||||
'click',
|
||||
event => {
|
||||
clearTimeout(this.blurTimeout); // Stop blur event
|
||||
this.addNode(event.currentTarget.innerText);
|
||||
this.addNode(event.currentTarget.innerText, event.currentTarget);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user