1
0

fix(filters): do not match partial labels

This change fixes a bug where an input query like "labels in test || labels in l" would be replaced with something like "undefinedabels in test || labels in l" or "3abels in test || labels in l" when there was a label starting with "l" - when it should not have touched that.
The matching was changed so that only exact label matches are taken into account when searching for labels.

Now, the above string would be replaced by "labels in 1 || labels in l" (when the label "test" has the id 1).

Maybe resolves https://community.vikunja.io/t/filtering-by-label-ux-issues/2393/8
This commit is contained in:
kolaente
2024-06-19 17:28:16 +02:00
parent 2690c99438
commit da66eb7314
3 changed files with 53 additions and 37 deletions

View File

@ -127,6 +127,16 @@ describe('Filter Transformation', () => {
expect(transformed).toBe('due_date = now/d || due_date > now/w+1w')
})
it('should only transform one label occurrence at a time', () => {
const transformed = transformFilterStringForApi(
'labels in ipsum || labels in l',
multipleDummyResolver,
nullTitleToIdResolver,
)
expect(transformed).toBe('labels in 2 || labels in l')
})
})
describe('To API', () => {