Skip to content

feat(filter): support @me and currentUser macros in task assignee queries - #3414

Open
mcassaniti wants to merge 1 commit into
go-vikunja:mainfrom
mcassaniti:feat/filter-me-macro
Open

feat(filter): support @me and currentUser macros in task assignee queries#3414
mcassaniti wants to merge 1 commit into
go-vikunja:mainfrom
mcassaniti:feat/filter-me-macro

Conversation

@mcassaniti

@mcassaniti mcassaniti commented Aug 3, 2026

Copy link
Copy Markdown

Resolves #3413

What this PR does

  1. Backend Dynamic Macro Resolution (pkg/models/task_search.go):

    • Added resolveCurrentUserMacros in dbTaskSearcher.Search.
    • Filter query terms matching @me, currentUser, or current_user in assignee queries dynamically resolve to the logged-in user's username (web.Auth). UPDATE: Now only @me.
    • The stored filter expression in the database retains @me so shared views resolve dynamically per user.
  2. Backend Unit Tests (pkg/models/task_search_test.go):

    • Added TestTaskSearchCurrentUserMacro testing string, slice, and array macro replacement.
  3. Frontend UX & Docs (FilterAutocomplete.ts & FilterInputDocs.vue):

    • Prepended @me (Current User (@me)) to autocomplete suggestions for assignees.
    • Added assignees in @me example to the filter help documentation.

Testing

  • Go unit test TestTaskSearchCurrentUserMacro passed.
  • 1,084 frontend Vitest unit tests passed.

Disclaimer: This PR was prepared with AI assistant pair programming. All code changes, database queries, unit tests, and commits have been reviewed, GPG-signed, and verified against the repository build pipeline.

@mcassaniti
mcassaniti force-pushed the feat/filter-me-macro branch from 77270c8 to 015702a Compare August 3, 2026 10:22
@kolaente

kolaente commented Aug 4, 2026

Copy link
Copy Markdown
Member

What happens when a user has me as their username?

@mcassaniti

Copy link
Copy Markdown
Author

Good question. For the frontend, the auto-complete will not match. Something like @m will however. This is why the frontend code uses startsWith(). The backend has exact matching regardless --> 'me' != '@me'.

I guess the code should reserve these special values and not allow them as a username. I'm fine if you want to change what is matched (e.g.: only currentUser is a valid pattern).

@ultinate

ultinate commented Aug 4, 2026

Copy link
Copy Markdown

Proposal: Only use @me as pattern. Not currentUser or current_user to avoid any conflicts with actual user names. This could extend to future patterns like @all or @admins.

This assumes that usernames starting with @ are not allowed.

@mcassaniti
mcassaniti force-pushed the feat/filter-me-macro branch from 015702a to 5006ec8 Compare August 5, 2026 04:19
@mcassaniti
mcassaniti force-pushed the feat/filter-me-macro branch from 5006ec8 to 570f301 Compare August 5, 2026 04:24
@mcassaniti

Copy link
Copy Markdown
Author

Done. The filter is restricted to @me only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Support @me and currentUser macros in task assignee filter queries

3 participants