{"action":"created","comment":{"url":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/comments/112367749","pull_request_review_id":33676270,"id":112367749,"diff_hunk":"@@ -269,64 +213,93 @@ class Prep {\n     }\n   }\n \n-  // Expectations:\n-  //   - the file path is present and valid\n-  async deleteFileAsync (side: SideName, doc: Metadata) {\n+  // TODO add comments + tests\n+  async restoreFileAsync (side: SideName, was: Metadata, doc: Metadata) {\n     ensureValidPath(doc)\n+    ensureValidPath(was)\n+    ensureValidChecksum(doc)\n \n+    delete doc.trashed\n     doc.docType = 'file'\n     buildId(doc)\n-    if ((side === 'local') && this.ignore.isIgnored(doc)) { return }\n-    return this.merge.deleteFileAsync(side, doc)\n-  }\n-\n-  deleteFile (side: SideName, doc: Metadata, callback: Callback) {\n-    // $FlowFixMe\n-    this.deleteFileAsync(side, doc).asCallback(callback)\n+    buildId(was)\n+    // TODO ignore.isIgnored\n+    return this.merge.restoreFileAsync(side, was, doc)\n   }\n \n-  // Expectations:\n-  //   - the folder path is present and valid\n-  async deleteFolderAsync (side: SideName, doc: Metadata) {\n+  // TODO add comments + tests\n+  async restoreFolderAsync (side: SideName, was: Metadata, doc: Metadata) {\n     ensureValidPath(doc)\n+    ensureValidPath(was)\n \n+    delete doc.trashed\n     doc.docType = 'folder'\n     buildId(doc)\n-    if ((side === 'local') && this.ignore.isIgnored(doc)) { return }\n-    return this.merge.deleteFolderAsync(side, doc)\n+    buildId(was)\n+    // TODO ignore.isIgnored\n+    return this.merge.restoreFolderAsync(side, was, doc)\n   }\n \n-  deleteFolder (side: SideName, doc: Metadata, callback: Callback) {\n-    // $FlowFixMe\n-    this.deleteFolderAsync(side, doc).asCallback(callback)\n-  }\n+  // TODO add comments + tests\n+  async trashFileAsync (side: SideName, was: *, doc: *) {\n+    ensureValidPath(was)\n+\n+    if (!doc) {\n+      doc = clone(was)\n+      doc.path = path.join(TRASH_DIR_NAME, was.path)\n+    }\n \n-  trashFileAsync (side: SideName, doc: *) {\n     ensureValidPath(doc)\n+    ensureValidChecksum(doc)\n \n+    doc.trashed = true\n     doc.docType = 'file'\n     buildId(doc)\n-    if ((side === 'local') && this.ignore.isIgnored(doc)) { return }\n-    return this.merge.trashAsync(side, doc)\n+    buildId(was)\n+    // TODO ignore.isIgnored\n+    return this.merge.trashFileAsync(side, was, doc)\n   }\n \n-  trashFile (side: SideName, doc: *, callback: Callback) {\n-    // $FlowFixMe\n-    this.trashFileAsync(side, doc).asCallback(callback)\n-  }\n+  // TODO add comments + tests\n+  async trashFolderAsync (side: SideName, was: *, doc: *) {\n+    ensureValidPath(was)\n+\n+    if (!doc) {\n+      doc = clone(was)\n+      doc.path = path.join(TRASH_DIR_NAME, was.path)\n+    }","path":"src/prep.js","position":252,"original_position":279,"commit_id":"8ab1957e8aafaa11941e3e6037685d9355a880a3","original_commit_id":"8ab1957e8aafaa11941e3e6037685d9355a880a3","user":{"login":"sebn","id":2260801,"avatar_url":"https://avatars1.githubusercontent.com/u/2260801?v=3","gravatar_id":"","url":"https://api.github.com/users/sebn","html_url":"https://github.com/sebn","followers_url":"https://api.github.com/users/sebn/followers","following_url":"https://api.github.com/users/sebn/following{/other_user}","gists_url":"https://api.github.com/users/sebn/gists{/gist_id}","starred_url":"https://api.github.com/users/sebn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebn/subscriptions","organizations_url":"https://api.github.com/users/sebn/orgs","repos_url":"https://api.github.com/users/sebn/repos","events_url":"https://api.github.com/users/sebn/events{/privacy}","received_events_url":"https://api.github.com/users/sebn/received_events","type":"User","site_admin":false},"body":"👌 ","created_at":"2017-04-20T05:24:39Z","updated_at":"2017-04-20T05:24:39Z","html_url":"https://github.com/cozy-labs/cozy-desktop/pull/640#discussion_r112367749","pull_request_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/640","_links":{"self":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/comments/112367749"},"html":{"href":"https://github.com/cozy-labs/cozy-desktop/pull/640#discussion_r112367749"},"pull_request":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/640"}}},"pull_request":{"url":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/640","id":116381073,"html_url":"https://github.com/cozy-labs/cozy-desktop/pull/640","diff_url":"https://github.com/cozy-labs/cozy-desktop/pull/640.diff","patch_url":"https://github.com/cozy-labs/cozy-desktop/pull/640.patch","issue_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/640","number":640,"state":"open","locked":false,"title":"Refactoring to be improve trashing files&folder","user":{"login":"nono","id":2767,"avatar_url":"https://avatars0.githubusercontent.com/u/2767?v=3","gravatar_id":"","url":"https://api.github.com/users/nono","html_url":"https://github.com/nono","followers_url":"https://api.github.com/users/nono/followers","following_url":"https://api.github.com/users/nono/following{/other_user}","gists_url":"https://api.github.com/users/nono/gists{/gist_id}","starred_url":"https://api.github.com/users/nono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nono/subscriptions","organizations_url":"https://api.github.com/users/nono/orgs","repos_url":"https://api.github.com/users/nono/repos","events_url":"https://api.github.com/users/nono/events{/privacy}","received_events_url":"https://api.github.com/users/nono/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-04-18T17:35:56Z","updated_at":"2017-04-20T05:24:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76d36db4cce53b160904a8dd3f2e6364ecd67057","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/640/commits","review_comments_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/640/comments","review_comment_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/640/comments","statuses_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/statuses/8ab1957e8aafaa11941e3e6037685d9355a880a3","head":{"label":"nono:trash","ref":"trash","sha":"8ab1957e8aafaa11941e3e6037685d9355a880a3","user":{"login":"nono","id":2767,"avatar_url":"https://avatars0.githubusercontent.com/u/2767?v=3","gravatar_id":"","url":"https://api.github.com/users/nono","html_url":"https://github.com/nono","followers_url":"https://api.github.com/users/nono/followers","following_url":"https://api.github.com/users/nono/following{/other_user}","gists_url":"https://api.github.com/users/nono/gists{/gist_id}","starred_url":"https://api.github.com/users/nono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nono/subscriptions","organizations_url":"https://api.github.com/users/nono/orgs","repos_url":"https://api.github.com/users/nono/repos","events_url":"https://api.github.com/users/nono/events{/privacy}","received_events_url":"https://api.github.com/users/nono/received_events","type":"User","site_admin":false},"repo":{"id":42134721,"name":"cozy-desktop","full_name":"nono/cozy-desktop","owner":{"login":"nono","id":2767,"avatar_url":"https://avatars0.githubusercontent.com/u/2767?v=3","gravatar_id":"","url":"https://api.github.com/users/nono","html_url":"https://github.com/nono","followers_url":"https://api.github.com/users/nono/followers","following_url":"https://api.github.com/users/nono/following{/other_user}","gists_url":"https://api.github.com/users/nono/gists{/gist_id}","starred_url":"https://api.github.com/users/nono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nono/subscriptions","organizations_url":"https://api.github.com/users/nono/orgs","repos_url":"https://api.github.com/users/nono/repos","events_url":"https://api.github.com/users/nono/events{/privacy}","received_events_url":"https://api.github.com/users/nono/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nono/cozy-desktop","description":"Synchronisation and offline mode for Cozy apps on desktop and laptop","fork":true,"url":"https://api.github.com/repos/nono/cozy-desktop","forks_url":"https://api.github.com/repos/nono/cozy-desktop/forks","keys_url":"https://api.github.com/repos/nono/cozy-desktop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nono/cozy-desktop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nono/cozy-desktop/teams","hooks_url":"https://api.github.com/repos/nono/cozy-desktop/hooks","issue_events_url":"https://api.github.com/repos/nono/cozy-desktop/issues/events{/number}","events_url":"https://api.github.com/repos/nono/cozy-desktop/events","assignees_url":"https://api.github.com/repos/nono/cozy-desktop/assignees{/user}","branches_url":"https://api.github.com/repos/nono/cozy-desktop/branches{/branch}","tags_url":"https://api.github.com/repos/nono/cozy-desktop/tags","blobs_url":"https://api.github.com/repos/nono/cozy-desktop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nono/cozy-desktop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nono/cozy-desktop/git/refs{/sha}","trees_url":"https://api.github.com/repos/nono/cozy-desktop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nono/cozy-desktop/statuses/{sha}","languages_url":"https://api.github.com/repos/nono/cozy-desktop/languages","stargazers_url":"https://api.github.com/repos/nono/cozy-desktop/stargazers","contributors_url":"https://api.github.com/repos/nono/cozy-desktop/contributors","subscribers_url":"https://api.github.com/repos/nono/cozy-desktop/subscribers","subscription_url":"https://api.github.com/repos/nono/cozy-desktop/subscription","commits_url":"https://api.github.com/repos/nono/cozy-desktop/commits{/sha}","git_commits_url":"https://api.github.com/repos/nono/cozy-desktop/git/commits{/sha}","comments_url":"https://api.github.com/repos/nono/cozy-desktop/comments{/number}","issue_comment_url":"https://api.github.com/repos/nono/cozy-desktop/issues/comments{/number}","contents_url":"https://api.github.com/repos/nono/cozy-desktop/contents/{+path}","compare_url":"https://api.github.com/repos/nono/cozy-desktop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nono/cozy-desktop/merges","archive_url":"https://api.github.com/repos/nono/cozy-desktop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nono/cozy-desktop/downloads","issues_url":"https://api.github.com/repos/nono/cozy-desktop/issues{/number}","pulls_url":"https://api.github.com/repos/nono/cozy-desktop/pulls{/number}","milestones_url":"https://api.github.com/repos/nono/cozy-desktop/milestones{/number}","notifications_url":"https://api.github.com/repos/nono/cozy-desktop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nono/cozy-desktop/labels{/name}","releases_url":"https://api.github.com/repos/nono/cozy-desktop/releases{/id}","deployments_url":"https://api.github.com/repos/nono/cozy-desktop/deployments","created_at":"2015-09-08T19:35:27Z","updated_at":"2017-02-06T13:14:52Z","pushed_at":"2017-04-19T14:53:45Z","git_url":"git://github.com/nono/cozy-desktop.git","ssh_url":"git@github.com:nono/cozy-desktop.git","clone_url":"https://github.com/nono/cozy-desktop.git","svn_url":"https://github.com/nono/cozy-desktop","homepage":"https://github.com/cozy-labs/cozy-desktop/releases","size":6236,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cozy-labs:master","ref":"master","sha":"c0f2341556b47c88a49ed908abf723c052dee9e1","user":{"login":"cozy-labs","id":8415593,"avatar_url":"https://avatars3.githubusercontent.com/u/8415593?v=3","gravatar_id":"","url":"https://api.github.com/users/cozy-labs","html_url":"https://github.com/cozy-labs","followers_url":"https://api.github.com/users/cozy-labs/followers","following_url":"https://api.github.com/users/cozy-labs/following{/other_user}","gists_url":"https://api.github.com/users/cozy-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/cozy-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozy-labs/subscriptions","organizations_url":"https://api.github.com/users/cozy-labs/orgs","repos_url":"https://api.github.com/users/cozy-labs/repos","events_url":"https://api.github.com/users/cozy-labs/events{/privacy}","received_events_url":"https://api.github.com/users/cozy-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":23385363,"name":"cozy-desktop","full_name":"cozy-labs/cozy-desktop","owner":{"login":"cozy-labs","id":8415593,"avatar_url":"https://avatars3.githubusercontent.com/u/8415593?v=3","gravatar_id":"","url":"https://api.github.com/users/cozy-labs","html_url":"https://github.com/cozy-labs","followers_url":"https://api.github.com/users/cozy-labs/followers","following_url":"https://api.github.com/users/cozy-labs/following{/other_user}","gists_url":"https://api.github.com/users/cozy-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/cozy-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozy-labs/subscriptions","organizations_url":"https://api.github.com/users/cozy-labs/orgs","repos_url":"https://api.github.com/users/cozy-labs/repos","events_url":"https://api.github.com/users/cozy-labs/events{/privacy}","received_events_url":"https://api.github.com/users/cozy-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cozy-labs/cozy-desktop","description":"File Synchronisation for Cozy on Desktop and Laptop","fork":false,"url":"https://api.github.com/repos/cozy-labs/cozy-desktop","forks_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/forks","keys_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/teams","hooks_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/hooks","issue_events_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/events{/number}","events_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/events","assignees_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/assignees{/user}","branches_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/branches{/branch}","tags_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/tags","blobs_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/git/refs{/sha}","trees_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/statuses/{sha}","languages_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/languages","stargazers_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/stargazers","contributors_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/contributors","subscribers_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/subscribers","subscription_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/subscription","commits_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/commits{/sha}","git_commits_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/git/commits{/sha}","comments_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/comments{/number}","issue_comment_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/comments{/number}","contents_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/contents/{+path}","compare_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/merges","archive_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/downloads","issues_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues{/number}","pulls_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls{/number}","milestones_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/milestones{/number}","notifications_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/labels{/name}","releases_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/releases{/id}","deployments_url":"https://api.github.com/repos/cozy-labs/cozy-desktop/deployments","created_at":"2014-08-27T10:10:38Z","updated_at":"2017-03-31T15:41:25Z","pushed_at":"2017-04-19T14:53:46Z","git_url":"git://github.com/cozy-labs/cozy-desktop.git","ssh_url":"git@github.com:cozy-labs/cozy-desktop.git","clone_url":"https://github.com/cozy-labs/cozy-desktop.git","svn_url":"https://github.com/cozy-labs/cozy-desktop","homepage":"https://cozy-labs.github.io/cozy-desktop/","size":6065,"stargazers_count":28,"watchers_count":28,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":17,"mirror_url":null,"open_issues_count":13,"forks":17,"open_issues":13,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/640"},"html":{"href":"https://github.com/cozy-labs/cozy-desktop/pull/640"},"issue":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/640"},"comments":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/issues/640/comments"},"review_comments":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/640/comments"},"review_comment":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/pulls/640/commits"},"statuses":{"href":"https://api.github.com/repos/cozy-labs/cozy-desktop/statuses/8ab1957e8aafaa11941e3e6037685d9355a880a3"}}}}
{"actor":{"display_login":"sebn"}}