Skip to content

Commit

Permalink
Allow system predicates to include uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
floogulinc committed Jun 6, 2024
1 parent 8725e92 commit ef5b109
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/app/tag-input/tag-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { TagInputDialogComponent } from '../tag-input-dialog/tag-input-dialog.co
import { SettingsService } from '../settings.service';
import { SystemPredicateRatingsDialogComponent } from '../system-predicate-ratings-dialog/system-predicate-ratings-dialog.component';
import { HydrusService } from '../hydrus-services';
import { searchTagsContainsSystemPredicate } from '../utils/tag-utils';
import { formatTagCase, getNamespace, searchTagsContainsSystemPredicate } from '../utils/tag-utils';
import { HydrusRatingsService } from '../hydrus-ratings.service';
import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
import { TagSiblingsParentsDialogComponent } from '../tag-siblings-parents-dialog/tag-siblings-parents-dialog.component';
Expand Down Expand Up @@ -132,9 +132,8 @@ export class TagInputComponent implements OnInit, ControlValueAccessor {
}

const input = event.chipInput.inputElement;
const value = event.value.toLowerCase(); // Hydrus tags are always lowercase

this.addSearchTag(value);
this.addSearchTag(event.value);

// Reset the input value
if (input) {
Expand All @@ -145,7 +144,7 @@ export class TagInputComponent implements OnInit, ControlValueAccessor {
}

addSearchTag(tag: string) {
const value = tag.toLowerCase();
const value = formatTagCase(tag);
if ((value || '').trim()) {
this.searchTags.push(value);
}
Expand Down
9 changes: 9 additions & 0 deletions src/app/utils/tag-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,12 @@ export function searchTagsContainsSystemPredicate(searchTags: HydrusSearchTag) {
return searchTags.findIndex(searchTagsContainsSystemPredicate) >= 0;
}
}


export function formatTagCase(tag: string) {
if(getNamespace(tag) === 'system') {
return tag;
} else {
return tag.toLowerCase();
}
}

0 comments on commit ef5b109

Please sign in to comment.