Show original task names for recurring tasks in search results (#914) (#915)

Recurring task templates had their names replaced with the recurrence
type label (e.g. "Weekly") in search results, making them unrecognizable.
Skip the display name transform when serializing tasks for search.
This commit is contained in:
Chris 2026-03-06 08:57:10 +02:00 committed by GitHub
parent d416c869f0
commit 3712d695fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 1 deletions

View file

@ -233,7 +233,9 @@ class SearchService {
params.offset
);
const serializedTasks = await serializeTasks(tasks, timezone);
const serializedTasks = await serializeTasks(tasks, timezone, {
skipDisplayNameTransform: true,
});
return {
count,

View file

@ -731,6 +731,28 @@ describe('Universal Search Routes', () => {
.filter((r) => r.type === 'Task')
.map((task) => task.original_name || task.name);
it('should include recurring tasks in default search with their original names', async () => {
const response = await agent.get('/api/search').query({
q: 'Recurring',
filters: 'Task',
});
expect(response.status).toBe(200);
const names = getTaskNames(response);
expect(names).toContain('Recurring Template');
expect(names).toContain('Recurring Instance');
// Verify template shows original name, not recurrence type label
const template = response.body.results.find(
(r) =>
r.type === 'Task' &&
r.recurrence_type === 'weekly' &&
!r.recurring_parent_id
);
expect(template).toBeDefined();
expect(template.name).toBe('Recurring Template');
});
it('should return only recurring tasks when extras contains recurring', async () => {
const response = await agent.get('/api/search').query({
filters: 'Task',