{"action":"created","comment":{"url":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/comments/206418642","pull_request_review_id":141822553,"id":206418642,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjQxODY0Mg==","diff_hunk":"@@ -0,0 +1,42 @@\n+import { Response } from 'express'\n+import * as validator from 'validator'\n+import { VideoChangeOwnershipModel } from '../../models/video/video-change-ownership'\n+import { UserModel } from '../../models/account/user'\n+\n+export async function doesChangeVideoOwnershipExist (id: string, res: Response): Promise<boolean> {\n+  const videoChangeOwnership = await loadVideoChangeOwnership(id)\n+\n+  if (!videoChangeOwnership) {\n+    res.status(404)\n+      .json({ error: 'Video change ownership not found' })\n+      .end()\n+\n+    return false\n+  }\n+\n+  res.locals.videoChangeOwnership = videoChangeOwnership\n+  return true\n+}\n+\n+async function loadVideoChangeOwnership (id: string): Promise<VideoChangeOwnershipModel | undefined> {\n+  if (validator.isInt(id)) {\n+    return VideoChangeOwnershipModel.load(parseInt(id, 10))\n+  } else {","path":"server/helpers/custom-validators/video-ownership.ts","position":24,"original_position":24,"commit_id":"8c89984aa7e1d065d77f7ca5256083bad178ed2c","original_commit_id":"8c89984aa7e1d065d77f7ca5256083bad178ed2c","user":{"login":"Chocobozzz","id":5180488,"node_id":"MDQ6VXNlcjUxODA0ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/5180488?v=4","gravatar_id":"","url":"https://api.github.com/users/Chocobozzz","html_url":"https://github.com/Chocobozzz","followers_url":"https://api.github.com/users/Chocobozzz/followers","following_url":"https://api.github.com/users/Chocobozzz/following{/other_user}","gists_url":"https://api.github.com/users/Chocobozzz/gists{/gist_id}","starred_url":"https://api.github.com/users/Chocobozzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chocobozzz/subscriptions","organizations_url":"https://api.github.com/users/Chocobozzz/orgs","repos_url":"https://api.github.com/users/Chocobozzz/repos","events_url":"https://api.github.com/users/Chocobozzz/events{/privacy}","received_events_url":"https://api.github.com/users/Chocobozzz/received_events","type":"User","site_admin":false},"body":"Don't need the `else`","created_at":"2018-07-31T07:23:18Z","updated_at":"2018-07-31T07:25:39Z","html_url":"https://github.com/Chocobozzz/PeerTube/pull/888#discussion_r206418642","pull_request_url":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/888","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/comments/206418642"},"html":{"href":"https://github.com/Chocobozzz/PeerTube/pull/888#discussion_r206418642"},"pull_request":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/888"}}},"pull_request":{"url":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/888","id":204658407,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NjU4NDA3","html_url":"https://github.com/Chocobozzz/PeerTube/pull/888","diff_url":"https://github.com/Chocobozzz/PeerTube/pull/888.diff","patch_url":"https://github.com/Chocobozzz/PeerTube/pull/888.patch","issue_url":"https://api.github.com/repos/Chocobozzz/PeerTube/issues/888","number":888,"state":"open","locked":false,"title":"WIP: Users can change ownership of their video [#510]","user":{"login":"grizio","id":11132978,"node_id":"MDQ6VXNlcjExMTMyOTc4","avatar_url":"https://avatars3.githubusercontent.com/u/11132978?v=4","gravatar_id":"","url":"https://api.github.com/users/grizio","html_url":"https://github.com/grizio","followers_url":"https://api.github.com/users/grizio/followers","following_url":"https://api.github.com/users/grizio/following{/other_user}","gists_url":"https://api.github.com/users/grizio/gists{/gist_id}","starred_url":"https://api.github.com/users/grizio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grizio/subscriptions","organizations_url":"https://api.github.com/users/grizio/orgs","repos_url":"https://api.github.com/users/grizio/repos","events_url":"https://api.github.com/users/grizio/events{/privacy}","received_events_url":"https://api.github.com/users/grizio/received_events","type":"User","site_admin":false},"body":"As described in #510, users can change ownership of their video.\r\n\r\nPlease look at the list of commits that explain how it was implemented.\r\n\r\n# QA\r\n\r\n## Prerequisites\r\n\r\n* You need two accounts\r\n* You need at least one video in one account\r\n\r\n## Give the ownership\r\n\r\n* Go to a video of the current user\r\n* Click on button « … »\r\n* Select « Change ownership »\r\n* A modal opens\r\n* Write the target user name (autocompletion should work starting with one character)\r\n* Validate\r\n* The request is sent\r\n\r\n## Accept the ownership\r\n\r\n* Change account to use the one of the targeted user from first scenario\r\n* Go to « My account »\r\n* Go to « Ownership change »\r\n* You see the request created in first scenario\r\n* Click on « Accept »\r\n* A modal opens\r\n* Select the channel\r\n* Validate\r\n* The request disappears from the list\r\n* If you go to the list of your videos, you will see the new video\r\n\r\n## Refuse the ownership\r\n\r\n* Change account to use the one of the targeted user from first scenario\r\n* Go to « My account »\r\n* Go to « Ownership change »\r\n* You see the request created in first scenario\r\n* Click on « Refuse »\r\n* The request disappears from the list (maybe could need a confirmation?)\r\n* If you go to the list of your videos, you will not see the new video\r\n\r\n## Other things to test\r\n\r\n* You cannot request the change of an ownership for another user\r\n* You cannot accept or refuse the ownership for another user\r\n\r\n## Gif time\r\n\r\n## Scenario 1\r\n\r\n![scenario-1](https://user-images.githubusercontent.com/11132978/43418052-1d66390a-943d-11e8-833e-c37b0c7a9a08.gif)\r\n\r\n* User 1 : ask the change of ownership to user 2\r\n* User 2 : accept the change of ownership\r\n\r\n## Scenario 2\r\n\r\n![scenario-2](https://user-images.githubusercontent.com/11132978/43418104-451cfbaa-943d-11e8-9086-c595734f6ac2.gif)\r\n\r\n* User 1 : ask the change of ownership to user 2\r\n* User 2 : refuse the change of ownership\r\n\r\n# TODO List\r\n\r\n- [ ] Create icons for:\r\n  - [ ] Change ownership button (:warning: Currently report abuse button!)\r\n  - [ ] Accept / refuse the ownership (none set)\r\n- [ ] Check the user experience of the whole process (should need a designer)\r\n- [ ] Add automatic tests\r\n- [ ] Add controls to avoid sending twice the same request\r\n- [ ] Add controls checking user quotas when accepting a request\r\n- [ ] Add notifications\r\n- [ ] Check i18n","created_at":"2018-07-29T19:51:05Z","updated_at":"2018-07-31T07:25:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"243849f399a5bad8931b35d5423b027031403a3b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":843705462,"node_id":"MDU6TGFiZWw4NDM3MDU0NjI=","url":"https://api.github.com/repos/Chocobozzz/PeerTube/labels/UI","name":"UI","color":"d4c5f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/888/commits","review_comments_url":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/888/comments","review_comment_url":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Chocobozzz/PeerTube/issues/888/comments","statuses_url":"https://api.github.com/repos/Chocobozzz/PeerTube/statuses/8c89984aa7e1d065d77f7ca5256083bad178ed2c","head":{"label":"grizio:510-change-ownership","ref":"510-change-ownership","sha":"8c89984aa7e1d065d77f7ca5256083bad178ed2c","user":{"login":"grizio","id":11132978,"node_id":"MDQ6VXNlcjExMTMyOTc4","avatar_url":"https://avatars3.githubusercontent.com/u/11132978?v=4","gravatar_id":"","url":"https://api.github.com/users/grizio","html_url":"https://github.com/grizio","followers_url":"https://api.github.com/users/grizio/followers","following_url":"https://api.github.com/users/grizio/following{/other_user}","gists_url":"https://api.github.com/users/grizio/gists{/gist_id}","starred_url":"https://api.github.com/users/grizio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grizio/subscriptions","organizations_url":"https://api.github.com/users/grizio/orgs","repos_url":"https://api.github.com/users/grizio/repos","events_url":"https://api.github.com/users/grizio/events{/privacy}","received_events_url":"https://api.github.com/users/grizio/received_events","type":"User","site_admin":false},"repo":{"id":116426516,"node_id":"MDEwOlJlcG9zaXRvcnkxMTY0MjY1MTY=","name":"PeerTube","full_name":"grizio/PeerTube","owner":{"login":"grizio","id":11132978,"node_id":"MDQ6VXNlcjExMTMyOTc4","avatar_url":"https://avatars3.githubusercontent.com/u/11132978?v=4","gravatar_id":"","url":"https://api.github.com/users/grizio","html_url":"https://github.com/grizio","followers_url":"https://api.github.com/users/grizio/followers","following_url":"https://api.github.com/users/grizio/following{/other_user}","gists_url":"https://api.github.com/users/grizio/gists{/gist_id}","starred_url":"https://api.github.com/users/grizio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grizio/subscriptions","organizations_url":"https://api.github.com/users/grizio/orgs","repos_url":"https://api.github.com/users/grizio/repos","events_url":"https://api.github.com/users/grizio/events{/privacy}","received_events_url":"https://api.github.com/users/grizio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/grizio/PeerTube","description":"[WIP] Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.","fork":true,"url":"https://api.github.com/repos/grizio/PeerTube","forks_url":"https://api.github.com/repos/grizio/PeerTube/forks","keys_url":"https://api.github.com/repos/grizio/PeerTube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grizio/PeerTube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grizio/PeerTube/teams","hooks_url":"https://api.github.com/repos/grizio/PeerTube/hooks","issue_events_url":"https://api.github.com/repos/grizio/PeerTube/issues/events{/number}","events_url":"https://api.github.com/repos/grizio/PeerTube/events","assignees_url":"https://api.github.com/repos/grizio/PeerTube/assignees{/user}","branches_url":"https://api.github.com/repos/grizio/PeerTube/branches{/branch}","tags_url":"https://api.github.com/repos/grizio/PeerTube/tags","blobs_url":"https://api.github.com/repos/grizio/PeerTube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grizio/PeerTube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grizio/PeerTube/git/refs{/sha}","trees_url":"https://api.github.com/repos/grizio/PeerTube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grizio/PeerTube/statuses/{sha}","languages_url":"https://api.github.com/repos/grizio/PeerTube/languages","stargazers_url":"https://api.github.com/repos/grizio/PeerTube/stargazers","contributors_url":"https://api.github.com/repos/grizio/PeerTube/contributors","subscribers_url":"https://api.github.com/repos/grizio/PeerTube/subscribers","subscription_url":"https://api.github.com/repos/grizio/PeerTube/subscription","commits_url":"https://api.github.com/repos/grizio/PeerTube/commits{/sha}","git_commits_url":"https://api.github.com/repos/grizio/PeerTube/git/commits{/sha}","comments_url":"https://api.github.com/repos/grizio/PeerTube/comments{/number}","issue_comment_url":"https://api.github.com/repos/grizio/PeerTube/issues/comments{/number}","contents_url":"https://api.github.com/repos/grizio/PeerTube/contents/{+path}","compare_url":"https://api.github.com/repos/grizio/PeerTube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grizio/PeerTube/merges","archive_url":"https://api.github.com/repos/grizio/PeerTube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grizio/PeerTube/downloads","issues_url":"https://api.github.com/repos/grizio/PeerTube/issues{/number}","pulls_url":"https://api.github.com/repos/grizio/PeerTube/pulls{/number}","milestones_url":"https://api.github.com/repos/grizio/PeerTube/milestones{/number}","notifications_url":"https://api.github.com/repos/grizio/PeerTube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grizio/PeerTube/labels{/name}","releases_url":"https://api.github.com/repos/grizio/PeerTube/releases{/id}","deployments_url":"https://api.github.com/repos/grizio/PeerTube/deployments","created_at":"2018-01-05T21:04:04Z","updated_at":"2018-07-28T16:00:10Z","pushed_at":"2018-07-30T19:21:13Z","git_url":"git://github.com/grizio/PeerTube.git","ssh_url":"git@github.com:grizio/PeerTube.git","clone_url":"https://github.com/grizio/PeerTube.git","svn_url":"https://github.com/grizio/PeerTube","homepage":"","size":12618,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"Chocobozzz:develop","ref":"develop","sha":"fb72c19384192d57252e7cb73cdcf8d0876f37a0","user":{"login":"Chocobozzz","id":5180488,"node_id":"MDQ6VXNlcjUxODA0ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/5180488?v=4","gravatar_id":"","url":"https://api.github.com/users/Chocobozzz","html_url":"https://github.com/Chocobozzz","followers_url":"https://api.github.com/users/Chocobozzz/followers","following_url":"https://api.github.com/users/Chocobozzz/following{/other_user}","gists_url":"https://api.github.com/users/Chocobozzz/gists{/gist_id}","starred_url":"https://api.github.com/users/Chocobozzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chocobozzz/subscriptions","organizations_url":"https://api.github.com/users/Chocobozzz/orgs","repos_url":"https://api.github.com/users/Chocobozzz/repos","events_url":"https://api.github.com/users/Chocobozzz/events{/privacy}","received_events_url":"https://api.github.com/users/Chocobozzz/received_events","type":"User","site_admin":false},"repo":{"id":45213667,"node_id":"MDEwOlJlcG9zaXRvcnk0NTIxMzY2Nw==","name":"PeerTube","full_name":"Chocobozzz/PeerTube","owner":{"login":"Chocobozzz","id":5180488,"node_id":"MDQ6VXNlcjUxODA0ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/5180488?v=4","gravatar_id":"","url":"https://api.github.com/users/Chocobozzz","html_url":"https://github.com/Chocobozzz","followers_url":"https://api.github.com/users/Chocobozzz/followers","following_url":"https://api.github.com/users/Chocobozzz/following{/other_user}","gists_url":"https://api.github.com/users/Chocobozzz/gists{/gist_id}","starred_url":"https://api.github.com/users/Chocobozzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chocobozzz/subscriptions","organizations_url":"https://api.github.com/users/Chocobozzz/orgs","repos_url":"https://api.github.com/users/Chocobozzz/repos","events_url":"https://api.github.com/users/Chocobozzz/events{/privacy}","received_events_url":"https://api.github.com/users/Chocobozzz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Chocobozzz/PeerTube","description":"Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.","fork":false,"url":"https://api.github.com/repos/Chocobozzz/PeerTube","forks_url":"https://api.github.com/repos/Chocobozzz/PeerTube/forks","keys_url":"https://api.github.com/repos/Chocobozzz/PeerTube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Chocobozzz/PeerTube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Chocobozzz/PeerTube/teams","hooks_url":"https://api.github.com/repos/Chocobozzz/PeerTube/hooks","issue_events_url":"https://api.github.com/repos/Chocobozzz/PeerTube/issues/events{/number}","events_url":"https://api.github.com/repos/Chocobozzz/PeerTube/events","assignees_url":"https://api.github.com/repos/Chocobozzz/PeerTube/assignees{/user}","branches_url":"https://api.github.com/repos/Chocobozzz/PeerTube/branches{/branch}","tags_url":"https://api.github.com/repos/Chocobozzz/PeerTube/tags","blobs_url":"https://api.github.com/repos/Chocobozzz/PeerTube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Chocobozzz/PeerTube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Chocobozzz/PeerTube/git/refs{/sha}","trees_url":"https://api.github.com/repos/Chocobozzz/PeerTube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Chocobozzz/PeerTube/statuses/{sha}","languages_url":"https://api.github.com/repos/Chocobozzz/PeerTube/languages","stargazers_url":"https://api.github.com/repos/Chocobozzz/PeerTube/stargazers","contributors_url":"https://api.github.com/repos/Chocobozzz/PeerTube/contributors","subscribers_url":"https://api.github.com/repos/Chocobozzz/PeerTube/subscribers","subscription_url":"https://api.github.com/repos/Chocobozzz/PeerTube/subscription","commits_url":"https://api.github.com/repos/Chocobozzz/PeerTube/commits{/sha}","git_commits_url":"https://api.github.com/repos/Chocobozzz/PeerTube/git/commits{/sha}","comments_url":"https://api.github.com/repos/Chocobozzz/PeerTube/comments{/number}","issue_comment_url":"https://api.github.com/repos/Chocobozzz/PeerTube/issues/comments{/number}","contents_url":"https://api.github.com/repos/Chocobozzz/PeerTube/contents/{+path}","compare_url":"https://api.github.com/repos/Chocobozzz/PeerTube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Chocobozzz/PeerTube/merges","archive_url":"https://api.github.com/repos/Chocobozzz/PeerTube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Chocobozzz/PeerTube/downloads","issues_url":"https://api.github.com/repos/Chocobozzz/PeerTube/issues{/number}","pulls_url":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls{/number}","milestones_url":"https://api.github.com/repos/Chocobozzz/PeerTube/milestones{/number}","notifications_url":"https://api.github.com/repos/Chocobozzz/PeerTube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Chocobozzz/PeerTube/labels{/name}","releases_url":"https://api.github.com/repos/Chocobozzz/PeerTube/releases{/id}","deployments_url":"https://api.github.com/repos/Chocobozzz/PeerTube/deployments","created_at":"2015-10-29T22:09:42Z","updated_at":"2018-07-31T01:05:20Z","pushed_at":"2018-07-30T19:21:14Z","git_url":"git://github.com/Chocobozzz/PeerTube.git","ssh_url":"git@github.com:Chocobozzz/PeerTube.git","clone_url":"https://github.com/Chocobozzz/PeerTube.git","svn_url":"https://github.com/Chocobozzz/PeerTube","homepage":"","size":12648,"stargazers_count":3701,"watchers_count":3701,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":307,"mirror_url":null,"archived":false,"open_issues_count":149,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":307,"open_issues":149,"watchers":3701,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/888"},"html":{"href":"https://github.com/Chocobozzz/PeerTube/pull/888"},"issue":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/issues/888"},"comments":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/issues/888/comments"},"review_comments":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/888/comments"},"review_comment":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/pulls/888/commits"},"statuses":{"href":"https://api.github.com/repos/Chocobozzz/PeerTube/statuses/8c89984aa7e1d065d77f7ca5256083bad178ed2c"}},"author_association":"NONE"}}
{"actor":{"display_login":"Chocobozzz"}}