{ "issue": { "url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "repository_url": "https://api.github.com/repos/laurent22/joplin", "labels_url": "https://api.github.com/repos/laurent22/joplin/issues/6886/labels{/name}", "comments_url": "https://api.github.com/repos/laurent22/joplin/issues/6886/comments", "events_url": "https://api.github.com/repos/laurent22/joplin/issues/6886/events", "html_url": "https://github.com/laurent22/joplin/pull/6886", "id": 1385034482, "node_id": "PR_kwDOBLftOs4_jnve", "number": 6886, "title": "API: Fixes #6862 set todo related fields when adding or changing a todo", "user": { "login": "Wartijn", "id": 10060747, "node_id": "MDQ6VXNlcjEwMDYwNzQ3", "avatar_url": "https://avatars.githubusercontent.com/u/10060747?v=4", "gravatar_id": "", "url": "https://api.github.com/users/Wartijn", "html_url": "https://github.com/Wartijn", "followers_url": "https://api.github.com/users/Wartijn/followers", "following_url": "https://api.github.com/users/Wartijn/following{/other_user}", "gists_url": "https://api.github.com/users/Wartijn/gists{/gist_id}", "starred_url": "https://api.github.com/users/Wartijn/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Wartijn/subscriptions", "organizations_url": "https://api.github.com/users/Wartijn/orgs", "repos_url": "https://api.github.com/users/Wartijn/repos", "events_url": "https://api.github.com/users/Wartijn/events{/privacy}", "received_events_url": "https://api.github.com/users/Wartijn/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "labels": [], "state": "closed", "locked": true, "assignee": null, "assignees": [], "milestone": null, "comments": 8, "created_at": "2022-09-25T13:54:36Z", "updated_at": "2022-12-27T15:18:39Z", "closed_at": "2022-12-27T15:18:28Z", "author_association": "CONTRIBUTOR", "sub_issues_summary": { "total": 0, "completed": 0, "percent_completed": 0 }, "active_lock_reason": null, "draft": false, "pull_request": { "url": "https://api.github.com/repos/laurent22/joplin/pulls/6886", "html_url": "https://github.com/laurent22/joplin/pull/6886", "diff_url": "https://github.com/laurent22/joplin/pull/6886.diff", "patch_url": "https://github.com/laurent22/joplin/pull/6886.patch", "merged_at": null }, "body": "- Set `todo_due` and `todo_completed` when adding a todo via the API. This fixes https://github.com/laurent22/joplin/issues/6862\r\n- Set `todo_due` and `todo_completed` when changing `is_todo`, to stay consistent with the behavior when adding a todo, and because those fields are only meant to be used in todos .\r\n- Update the api docs to reflect these changes.\r\n\r\n\r\nI don't know if it makes sense to only be able to set `todo_completed` if `todo_due` is set. So I haven't added checks for that. ", "closed_by": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/6886/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "timeline_url": "https://api.github.com/repos/laurent22/joplin/issues/6886/timeline", "performed_via_github_app": null, "state_reason": null }, "comments": [ { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1263552663", "html_url": "https://github.com/laurent22/joplin/pull/6886#issuecomment-1263552663", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "id": 1263552663, "node_id": "IC_kwDOBLftOs5LUEiX", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-09-30T13:06:52Z", "updated_at": "2022-09-30T13:06:52Z", "author_association": "OWNER", "body": "There shouldn't be any business logic in the API layer. Instead it should reuse what's already defined in the models.", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1263552663/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1263831251", "html_url": "https://github.com/laurent22/joplin/pull/6886#issuecomment-1263831251", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "id": 1263831251, "node_id": "IC_kwDOBLftOs5LVIjT", "user": { "login": "Wartijn", "id": 10060747, "node_id": "MDQ6VXNlcjEwMDYwNzQ3", "avatar_url": "https://avatars.githubusercontent.com/u/10060747?v=4", "gravatar_id": "", "url": "https://api.github.com/users/Wartijn", "html_url": "https://github.com/Wartijn", "followers_url": "https://api.github.com/users/Wartijn/followers", "following_url": "https://api.github.com/users/Wartijn/following{/other_user}", "gists_url": "https://api.github.com/users/Wartijn/gists{/gist_id}", "starred_url": "https://api.github.com/users/Wartijn/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Wartijn/subscriptions", "organizations_url": "https://api.github.com/users/Wartijn/orgs", "repos_url": "https://api.github.com/users/Wartijn/repos", "events_url": "https://api.github.com/users/Wartijn/events{/privacy}", "received_events_url": "https://api.github.com/users/Wartijn/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-09-30T17:26:24Z", "updated_at": "2022-09-30T17:26:24Z", "author_association": "CONTRIBUTOR", "body": "So, add these checks to the save method of Note? I thought about that, but decided against it because it didn't seem necessary to do that check every time, since the updates from the apps use `changeNoteType`. But `changeNoteType` always sets `todo_completed` and `todo_due` to 0 when changing types. If I'm not mistaken only the api lets you set `is_todo` at the same time as those two fiields. ", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1263831251/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1264383924", "html_url": "https://github.com/laurent22/joplin/pull/6886#issuecomment-1264383924", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "id": 1264383924, "node_id": "IC_kwDOBLftOs5LXPe0", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-10-01T14:37:14Z", "updated_at": "2022-10-01T14:37:14Z", "author_association": "OWNER", "body": "No, there are methods in models/Note to change the state of a note and that should be used.", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1264383924/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1270330515", "html_url": "https://github.com/laurent22/joplin/pull/6886#issuecomment-1270330515", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "id": 1270330515, "node_id": "IC_kwDOBLftOs5Lt7ST", "user": { "login": "Wartijn", "id": 10060747, "node_id": "MDQ6VXNlcjEwMDYwNzQ3", "avatar_url": "https://avatars.githubusercontent.com/u/10060747?v=4", "gravatar_id": "", "url": "https://api.github.com/users/Wartijn", "html_url": "https://github.com/Wartijn", "followers_url": "https://api.github.com/users/Wartijn/followers", "following_url": "https://api.github.com/users/Wartijn/following{/other_user}", "gists_url": "https://api.github.com/users/Wartijn/gists{/gist_id}", "starred_url": "https://api.github.com/users/Wartijn/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Wartijn/subscriptions", "organizations_url": "https://api.github.com/users/Wartijn/orgs", "repos_url": "https://api.github.com/users/Wartijn/repos", "events_url": "https://api.github.com/users/Wartijn/events{/privacy}", "received_events_url": "https://api.github.com/users/Wartijn/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-10-06T16:03:45Z", "updated_at": "2022-10-06T16:13:23Z", "author_association": "CONTRIBUTOR", "body": "I don't really understand how I should approach that: \r\n\r\nFor POST:\r\nThere is no change in note type, so calling those methods seems like the wrong thing to do.\r\n\r\nFor PUT:\r\nThere is `Note.changeNoteType` that could be used, but the problems with that are:\r\n\r\n- `changeNoteType` doesn't have the right behavior when switching from note to todo (see my previous comment) \r\n- The note is updated by overriding all the new props via a spread operator (in routes/notes). This already sets the todo-related fields, so those fields would have to be filtered out first, because else `changeNoteType` will be called after the note type has already been changed. \r\n\r\nIt is of course possible to change `changeNoteType` or create a new method in Note. But because the rest api is (afaik) the only place where you can set `is_todo` at the same time as `todo_completed` and `todo_due`, this does seem like adding quite a lot of code to remove api-related logic form the api layer \r\n", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1270330515/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1361675030", "html_url": "https://github.com/laurent22/joplin/pull/6886#issuecomment-1361675030", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "id": 1361675030, "node_id": "IC_kwDOBLftOs5RKYMW", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-12-21T17:02:23Z", "updated_at": "2022-12-21T17:02:23Z", "author_association": "OWNER", "body": "recheck", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1361675030/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1361675334", "html_url": "https://github.com/laurent22/joplin/pull/6886#issuecomment-1361675334", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "id": 1361675334, "node_id": "IC_kwDOBLftOs5RKYRG", "user": { "login": "github-actions[bot]", "id": 41898282, "node_id": "MDM6Qm90NDE4OTgyODI=", "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github-actions%5Bbot%5D", "html_url": "https://github.com/apps/github-actions", "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", "type": "Bot", "user_view_type": "public", "site_admin": false }, "created_at": "2022-12-21T17:02:37Z", "updated_at": "2022-12-23T16:13:35Z", "author_association": "CONTRIBUTOR", "body": "****CLA Assistant Lite bot**** All contributors have signed the CLA ✍️ ✅", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1361675334/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1364085068", "html_url": "https://github.com/laurent22/joplin/pull/6886#issuecomment-1364085068", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "id": 1364085068, "node_id": "IC_kwDOBLftOs5RTklM", "user": { "login": "Wartijn", "id": 10060747, "node_id": "MDQ6VXNlcjEwMDYwNzQ3", "avatar_url": "https://avatars.githubusercontent.com/u/10060747?v=4", "gravatar_id": "", "url": "https://api.github.com/users/Wartijn", "html_url": "https://github.com/Wartijn", "followers_url": "https://api.github.com/users/Wartijn/followers", "following_url": "https://api.github.com/users/Wartijn/following{/other_user}", "gists_url": "https://api.github.com/users/Wartijn/gists{/gist_id}", "starred_url": "https://api.github.com/users/Wartijn/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Wartijn/subscriptions", "organizations_url": "https://api.github.com/users/Wartijn/orgs", "repos_url": "https://api.github.com/users/Wartijn/repos", "events_url": "https://api.github.com/users/Wartijn/events{/privacy}", "received_events_url": "https://api.github.com/users/Wartijn/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-12-23T16:13:19Z", "updated_at": "2022-12-23T16:13:19Z", "author_association": "CONTRIBUTOR", "body": "I have read the CLA Document and I hereby sign the CLA", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1364085068/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1365977020", "html_url": "https://github.com/laurent22/joplin/pull/6886#issuecomment-1365977020", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/6886", "id": 1365977020, "node_id": "IC_kwDOBLftOs5Raye8", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2022-12-27T15:18:28Z", "updated_at": "2022-12-27T15:18:28Z", "author_association": "OWNER", "body": "Closing this one as duplicate of #7395 ", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1365977020/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null } ] }