Creating task on saved filter page doesn't save

Hopefully this isn’t a duplicate bug report, but I couldn’t find anything similar. If I’m sitting on a saved filter page and use Ctrl+K to create a task, the data posted back to the server is incomplete and I’m redirected to an empty task with an ID of 0.

First, the PUT request is made to https://example.com/api/v1/projects/-2/tasks, which is maybe fine (-2 seems to be the ID of this saved filter). The payload is as follows:

{
  "max_right": null,
  "id": 0,
  "title": "Test task from ctrl k",
  "description": "",
  "done": false,
  "done_at": null,
  "priority": 0,
  "labels": [],
  "assignees": [],
  "due_date": null,
  "start_date": null,
  "end_date": null,
  "repeat_after": 0,
  "repeat_from_current_date": false,
  "repeat_mode": 0,
  "reminders": [],
  "parent_task_id": 0,
  "hex_color": "",
  "percent_done": 0,
  "related_tasks": {},
  "attachments": [],
  "cover_image_attachment_id": null,
  "identifier": "",
  "index": 0,
  "is_favorite": false,
  "subscription": null,
  "position": 0,
  "kanban_position": 0,
  "created_by": {
    "max_right": null,
    "id": 0,
    "email": "",
    "username": "",
    "name": "",
    "exp": 0,
    "type": 0,
    "created": null,
    "updated": null,
    "settings": {
      "max_right": null,
      "name": "",
      "email_reminders_enabled": true,
      "discoverable_by_name": false,
      "discoverable_by_email": false,
      "overdue_tasks_reminders_enabled": true,
      "week_start": 0,
      "timezone": "",
      "language": "en",
      "frontend_settings": {
        "play_sound_when_done": true,
        "quick_add_magic_mode": "vikunja",
        "color_schema": "auto"
      }
    }
  },
  "created": "1970-01-01T00:00:00.000Z",
  "updated": "1970-01-01T00:00:00.000Z",
  "project_id": -2,
  "bucket_id": 0,
  "reminder_dates": null
}

The PUT returns a 200, and then I’m redirected to https://example.com/tasks/0 that does not show the description I entered. I think I’d expect this flow to result in the task being put into my default project since I’m not currently in a “real” project.

Interestingly, I get the same behavior even if I use the +ProjectName shorthand in the task creation field.

I’m pretty sure you’re not supposed to be creating tasks from the saved filter page. A task always belongs to one project, and a saved filter can easily span multiple projects.

Either Vikunja needs to ask for the project the task should be created in (and/or detect if the filter is actually only for one project), or the keyboard shortcut to create new tasks should be hidden in this context to avoid confusion.

If you’re creating a task from the quick actions, it will use the current project if you have one open (or a task). Internally, filters are treated as a project as well, hence it will just use that id as project id and create a task with it. That should obviously not be the case.

This is now fixed in 1de39b1cd1. Please check with the next unstable build (ready in ~45min or on try).

1 Like

If saved filters are flagged as such (by having a negative ID, for instance), then Vikunja could use the user’s default project for creating a task. That’s what happens if you make a task on the Overview page, which is also a multi-project view.

Whoa, that was fast! Thank you.