{"action":"created","comment":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/74254812","id":74254812,"diff_hunk":"@@ -0,0 +1,42 @@\n+#!/usr/bin/env python\n+# encoding: utf-8\n+\"\"\"Migrate Share Windows to existing users\n+\n+Run dry run: python -m scripts.migrate_public_files_nodes --dry\n+Run migration: python -m scripts.migrate_public_files_nodes\n+\n+\"\"\"\n+import sys\n+import logging\n+\n+from website.app import init_app\n+from framework.auth import core\n+from website.public_files import give_user_public_files_node\n+from framework.transactions.context import TokuTransaction\n+\n+from scripts import utils as script_utils\n+\n+\n+logger = logging.getLogger(__name__)\n+logging.basicConfig(level=logging.INFO)\n+\n+def main(dry_run):\n+    users = core.User.find()\n+\n+    for user in users:\n+        if user.is_registered and user.public_files_node is None:","path":"scripts/migrate_public_files_nodes.py","position":27,"original_position":27,"commit_id":"036c8b4f0c752a9c7febef950431a5aa71ad92fc","original_commit_id":"036c8b4f0c752a9c7febef950431a5aa71ad92fc","user":{"login":"caseyrollins","id":7913604,"avatar_url":"https://avatars.githubusercontent.com/u/7913604?v=3","gravatar_id":"","url":"https://api.github.com/users/caseyrollins","html_url":"https://github.com/caseyrollins","followers_url":"https://api.github.com/users/caseyrollins/followers","following_url":"https://api.github.com/users/caseyrollins/following{/other_user}","gists_url":"https://api.github.com/users/caseyrollins/gists{/gist_id}","starred_url":"https://api.github.com/users/caseyrollins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseyrollins/subscriptions","organizations_url":"https://api.github.com/users/caseyrollins/orgs","repos_url":"https://api.github.com/users/caseyrollins/repos","events_url":"https://api.github.com/users/caseyrollins/events{/privacy}","received_events_url":"https://api.github.com/users/caseyrollins/received_events","type":"User","site_admin":false},"body":"Will a public files node be created for existing unregistered users when they register?","created_at":"2016-08-10T14:28:27Z","updated_at":"2016-08-10T14:28:27Z","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/5942#discussion_r74254812","pull_request_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/5942","_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments/74254812"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/5942#discussion_r74254812"},"pull_request":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/5942"}}},"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/5942","id":76752358,"html_url":"https://github.com/CenterForOpenScience/osf.io/pull/5942","diff_url":"https://github.com/CenterForOpenScience/osf.io/pull/5942.diff","patch_url":"https://github.com/CenterForOpenScience/osf.io/pull/5942.patch","issue_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/5942","number":5942,"state":"open","locked":false,"title":"Share files","user":{"login":"Johnetordoff","id":9688518,"avatar_url":"https://avatars.githubusercontent.com/u/9688518?v=3","gravatar_id":"","url":"https://api.github.com/users/Johnetordoff","html_url":"https://github.com/Johnetordoff","followers_url":"https://api.github.com/users/Johnetordoff/followers","following_url":"https://api.github.com/users/Johnetordoff/following{/other_user}","gists_url":"https://api.github.com/users/Johnetordoff/gists{/gist_id}","starred_url":"https://api.github.com/users/Johnetordoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Johnetordoff/subscriptions","organizations_url":"https://api.github.com/users/Johnetordoff/orgs","repos_url":"https://api.github.com/users/Johnetordoff/repos","events_url":"https://api.github.com/users/Johnetordoff/events{/privacy}","received_events_url":"https://api.github.com/users/Johnetordoff/received_events","type":"User","site_admin":false},"body":"## Purpose\r\n\r\nAllows user to easily share files without having to create a project.\r\n\r\n## Changes\r\n\r\nCreates a dropzone widget on the front page for file drops and gives each user a new type of node (is_public_files_collection) that they can upload files to.\r\n\r\n###  \"Public Files\" node:\r\n- Dropped files go here, directly to osfstorage root directory\r\n- Given to a user when he/she registers\r\n- Is public\r\n- Titled \"Public Files\" \r\n- Cannot be deleted or modified in a number of ways (functions are disabled using a decorator) \r\n- Has specialized merge behavior in the event of a user merge. The merge is canceled and user is prompted if they have files of conflicting versions.\r\n- Doesn't appear in ES results.\r\n- Creates users/<uid>/public_files endpoint for api v2, whose primary use case is to provide info for user profiles.\r\n\r\n###  The Dropzone (fig 1-2):\r\n- Uses dropzone.js\r\n- When a file is dropped into the Dropzone uploads the file and creates a preview with a link to the file-view-page. (fig 2)\r\n- Only a single file can be dropped at a time, but many can be previewed uploaded one-by-one (this is a UX decision).\r\n- Contains a clipboard button for easy copying \r\n- Contains link to Public Files file browser which is typical fangorn browser modified with clipboard. (fig 3)\r\n\r\n## Side effects\r\n\r\nNow running the api endpoint for for the file detail generates a guid.\r\n\r\n## Ticket\r\n\r\nhttps://openscience.atlassian.net/browse/RND-61\r\n\r\n## Screen Shots\r\n\r\nfig 1.\r\n<img width=\"900\" alt=\"screen shot 2016-06-27 at 4 45 51 pm\" src=\"https://cloud.githubusercontent.com/assets/9688518/16395175/a4d03ea6-3c86-11e6-9172-024a208dc063.png\">\r\n\r\nfig 2.\r\n<img width=\"1105\" alt=\"screen shot 2016-06-27 at 4 44 50 pm\" src=\"https://cloud.githubusercontent.com/assets/9688518/16395159/916b2bc8-3c86-11e6-8056-f5e62549d317.png\">\r\n\r\nfig 3.\r\n<img width=\"1268\" alt=\"screen shot 2016-06-27 at 4 46 55 pm\" src=\"https://cloud.githubusercontent.com/assets/9688518/16395225/d2c16ad8-3c86-11e6-80b0-898cfbb99a0b.png\">\r\n\r\n","created_at":"2016-07-08T13:26:16Z","updated_at":"2016-08-10T14:28:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9979630c5850a78f21405c752d57f079d69a0be3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/5942/commits","review_comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/5942/comments","review_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/5942/comments","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/036c8b4f0c752a9c7febef950431a5aa71ad92fc","head":{"label":"Johnetordoff:shareFiles","ref":"shareFiles","sha":"036c8b4f0c752a9c7febef950431a5aa71ad92fc","user":{"login":"Johnetordoff","id":9688518,"avatar_url":"https://avatars.githubusercontent.com/u/9688518?v=3","gravatar_id":"","url":"https://api.github.com/users/Johnetordoff","html_url":"https://github.com/Johnetordoff","followers_url":"https://api.github.com/users/Johnetordoff/followers","following_url":"https://api.github.com/users/Johnetordoff/following{/other_user}","gists_url":"https://api.github.com/users/Johnetordoff/gists{/gist_id}","starred_url":"https://api.github.com/users/Johnetordoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Johnetordoff/subscriptions","organizations_url":"https://api.github.com/users/Johnetordoff/orgs","repos_url":"https://api.github.com/users/Johnetordoff/repos","events_url":"https://api.github.com/users/Johnetordoff/events{/privacy}","received_events_url":"https://api.github.com/users/Johnetordoff/received_events","type":"User","site_admin":false},"repo":{"id":36686922,"name":"osf.io","full_name":"Johnetordoff/osf.io","owner":{"login":"Johnetordoff","id":9688518,"avatar_url":"https://avatars.githubusercontent.com/u/9688518?v=3","gravatar_id":"","url":"https://api.github.com/users/Johnetordoff","html_url":"https://github.com/Johnetordoff","followers_url":"https://api.github.com/users/Johnetordoff/followers","following_url":"https://api.github.com/users/Johnetordoff/following{/other_user}","gists_url":"https://api.github.com/users/Johnetordoff/gists{/gist_id}","starred_url":"https://api.github.com/users/Johnetordoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Johnetordoff/subscriptions","organizations_url":"https://api.github.com/users/Johnetordoff/orgs","repos_url":"https://api.github.com/users/Johnetordoff/repos","events_url":"https://api.github.com/users/Johnetordoff/events{/privacy}","received_events_url":"https://api.github.com/users/Johnetordoff/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Johnetordoff/osf.io","description":"Facilitating Open Science","fork":true,"url":"https://api.github.com/repos/Johnetordoff/osf.io","forks_url":"https://api.github.com/repos/Johnetordoff/osf.io/forks","keys_url":"https://api.github.com/repos/Johnetordoff/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Johnetordoff/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Johnetordoff/osf.io/teams","hooks_url":"https://api.github.com/repos/Johnetordoff/osf.io/hooks","issue_events_url":"https://api.github.com/repos/Johnetordoff/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/Johnetordoff/osf.io/events","assignees_url":"https://api.github.com/repos/Johnetordoff/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/Johnetordoff/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/Johnetordoff/osf.io/tags","blobs_url":"https://api.github.com/repos/Johnetordoff/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Johnetordoff/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Johnetordoff/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/Johnetordoff/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Johnetordoff/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/Johnetordoff/osf.io/languages","stargazers_url":"https://api.github.com/repos/Johnetordoff/osf.io/stargazers","contributors_url":"https://api.github.com/repos/Johnetordoff/osf.io/contributors","subscribers_url":"https://api.github.com/repos/Johnetordoff/osf.io/subscribers","subscription_url":"https://api.github.com/repos/Johnetordoff/osf.io/subscription","commits_url":"https://api.github.com/repos/Johnetordoff/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/Johnetordoff/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/Johnetordoff/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/Johnetordoff/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/Johnetordoff/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/Johnetordoff/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Johnetordoff/osf.io/merges","archive_url":"https://api.github.com/repos/Johnetordoff/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Johnetordoff/osf.io/downloads","issues_url":"https://api.github.com/repos/Johnetordoff/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/Johnetordoff/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/Johnetordoff/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/Johnetordoff/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Johnetordoff/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/Johnetordoff/osf.io/releases{/id}","deployments_url":"https://api.github.com/repos/Johnetordoff/osf.io/deployments","created_at":"2015-06-01T20:29:12Z","updated_at":"2016-05-26T18:42:18Z","pushed_at":"2016-08-10T14:20:52Z","git_url":"git://github.com/Johnetordoff/osf.io.git","ssh_url":"git@github.com:Johnetordoff/osf.io.git","clone_url":"https://github.com/Johnetordoff/osf.io.git","svn_url":"https://github.com/Johnetordoff/osf.io","homepage":"http://osf.io","size":134016,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":"develop"}},"base":{"label":"CenterForOpenScience:develop","ref":"develop","sha":"4996a0f90784957274142ef1417f07bf7b4d82f9","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":10199599,"name":"osf.io","full_name":"CenterForOpenScience/osf.io","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/osf.io","description":"Facilitating Open Science","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/osf.io","forks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/releases{/id}","deployments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/deployments","created_at":"2013-05-21T15:53:37Z","updated_at":"2016-08-09T09:39:08Z","pushed_at":"2016-08-10T14:27:36Z","git_url":"git://github.com/CenterForOpenScience/osf.io.git","ssh_url":"git@github.com:CenterForOpenScience/osf.io.git","clone_url":"https://github.com/CenterForOpenScience/osf.io.git","svn_url":"https://github.com/CenterForOpenScience/osf.io","homepage":"http://osf.io","size":265070,"stargazers_count":247,"watchers_count":247,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":196,"mirror_url":null,"open_issues_count":195,"forks":196,"open_issues":195,"watchers":247,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/5942"},"html":{"href":"https://github.com/CenterForOpenScience/osf.io/pull/5942"},"issue":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/5942"},"comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/5942/comments"},"review_comments":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/5942/comments"},"review_comment":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/5942/commits"},"statuses":{"href":"https://api.github.com/repos/CenterForOpenScience/osf.io/statuses/036c8b4f0c752a9c7febef950431a5aa71ad92fc"}}}}
{"actor":{"display_login":"caseyrollins"}}