{"action":"created","comment":{"url":"https://api.github.com/repos/scopyleft/cafebabel/pulls/comments/142479903","pull_request_review_id":66847915,"id":142479903,"diff_hunk":"@@ -1,64 +1,76 @@\n {% extends 'base.html' %}\n \n-{% block mode %}{% if edit %}edit{% endif %}{% endblock %}\n-\n {% block body %}\n+{% if user.id %}\n <h1>{{ user }}'s profile</h1>\n+{% else %}\n+<h1>Create a profile</h1>\n+{% endif %}\n+\n <ul>\n   <li>firstname: <span data-edit=firstname>{{ user.firstname or '' }}</span></li>\n   <li>lastname: <span data-edit=lastname>{{ user.lastname or '' }}</span></li>\n   <li>email: <span data-edit=email>{{ user.email or '' }}</span></li>\n </ul>\n \n-{# <p>\n-  <a href={{ url_for('api_user_put', id=user.id) }}>Edit this profile</a>\n-  <form method=post action={{ url_for('user_delete', id=user.id) }}>\n+{% if not edit %}\n+  <a href=?edit>Edit this profile</a>\n+{% endif %}\n+\n+{% if edit %}\n+  {% if user.id %}\n+  <form class=user-delete data-method=delete action={{ url_for('api_user_delete', id=user.id) }}>\n     <button type=submit>Delete this profile</button>\n   </form>\n-</p> #}\n+  {% endif %}\n \n-{% if edit %}\n   {% if user.id %}\n-  <form class=page-save data-method=put action={{ url_for('api_user_put', id=user.id) }}>\n+  <form class=user-save data-method=put action={{ url_for('api_user_put', id=user.id) }}>\n   {% else %}\n-  <form class=page-save method=post action={{ url_for('api_user_post') }}>\n+  <form class=user-save method=post action={{ url_for('api_user_post') }}>\n   {% endif %}\n     <button type=submit>Save my profile</button>\n   </form>\n-{% endif %}\n \n-<script>\n-Array.from(document.querySelectorAll('body.edit [data-edit]')).forEach(editable => {\n-  editable.setAttribute('contentEditable', true)\n-})\n+  <script>\n+    Array.from(document.querySelectorAll('[data-edit]')).forEach(editable => {\n+      editable.setAttribute('contentEditable', true)\n+    })\n \n-document.querySelector('.page-save').addEventListener('submit', event => {\n-  event.preventDefault()\n+    document.querySelector('.user-save').addEventListener('submit', event => {\n+      event.preventDefault()\n \n-  const fields = Array.from(document.querySelectorAll('[data-edit]'))\n-  const data = {\n-    'firstname': fields.find(f => f.dataset.edit === 'firstname').textContent,\n-    'lastname': fields.find(f => f.dataset.edit === 'lastname').textContent,\n-    'email': fields.find(f => f.dataset.edit === 'email').textContent,\n-  }\n+      const fields = Array.from(document.querySelectorAll('[data-edit]'))\n+      const data = {\n+        'firstname': fields.find(f => f.dataset.edit === 'firstname').textContent,\n+        'lastname': fields.find(f => f.dataset.edit === 'lastname').textContent,\n+        'email': fields.find(f => f.dataset.edit === 'email').textContent,\n+      }\n+\n+      request(event.target.action, {\n+        method: event.target.dataset.method || event.target.method,\n+        body: data\n+      })\n+      .then(r => {\n+        location.href = `/user/${r.body.id}/`\n+      })","path":"templates/user.html","position":78,"original_position":78,"commit_id":"bd510ebd103ba55358ed1d9c215be25387feee0f","original_commit_id":"bd510ebd103ba55358ed1d9c215be25387feee0f","user":{"login":"vinyll","id":145172,"avatar_url":"https://avatars1.githubusercontent.com/u/145172?v=4","gravatar_id":"","url":"https://api.github.com/users/vinyll","html_url":"https://github.com/vinyll","followers_url":"https://api.github.com/users/vinyll/followers","following_url":"https://api.github.com/users/vinyll/following{/other_user}","gists_url":"https://api.github.com/users/vinyll/gists{/gist_id}","starred_url":"https://api.github.com/users/vinyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinyll/subscriptions","organizations_url":"https://api.github.com/users/vinyll/orgs","repos_url":"https://api.github.com/users/vinyll/repos","events_url":"https://api.github.com/users/vinyll/events{/privacy}","received_events_url":"https://api.github.com/users/vinyll/received_events","type":"User","site_admin":false},"body":"Error catching are on their way 🏃 ","created_at":"2017-10-03T18:14:12Z","updated_at":"2017-10-03T18:14:12Z","html_url":"https://github.com/scopyleft/cafebabel/pull/2#discussion_r142479903","pull_request_url":"https://api.github.com/repos/scopyleft/cafebabel/pulls/2","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scopyleft/cafebabel/pulls/comments/142479903"},"html":{"href":"https://github.com/scopyleft/cafebabel/pull/2#discussion_r142479903"},"pull_request":{"href":"https://api.github.com/repos/scopyleft/cafebabel/pulls/2"}},"in_reply_to_id":142479703},"pull_request":{"url":"https://api.github.com/repos/scopyleft/cafebabel/pulls/2","id":144469587,"html_url":"https://github.com/scopyleft/cafebabel/pull/2","diff_url":"https://github.com/scopyleft/cafebabel/pull/2.diff","patch_url":"https://github.com/scopyleft/cafebabel/pull/2.patch","issue_url":"https://api.github.com/repos/scopyleft/cafebabel/issues/2","number":2,"state":"open","locked":false,"title":"Updated user crud for redirecting accordingly to the user action.","user":{"login":"vinyll","id":145172,"avatar_url":"https://avatars1.githubusercontent.com/u/145172?v=4","gravatar_id":"","url":"https://api.github.com/users/vinyll","html_url":"https://github.com/vinyll","followers_url":"https://api.github.com/users/vinyll/followers","following_url":"https://api.github.com/users/vinyll/following{/other_user}","gists_url":"https://api.github.com/users/vinyll/gists{/gist_id}","starred_url":"https://api.github.com/users/vinyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinyll/subscriptions","organizations_url":"https://api.github.com/users/vinyll/orgs","repos_url":"https://api.github.com/users/vinyll/repos","events_url":"https://api.github.com/users/vinyll/events{/privacy}","received_events_url":"https://api.github.com/users/vinyll/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-10-03T16:32:08Z","updated_at":"2017-10-03T18:14:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5fea94688f0adf5a1779db6f3e4837559ac91164","assignee":{"login":"vinyll","id":145172,"avatar_url":"https://avatars1.githubusercontent.com/u/145172?v=4","gravatar_id":"","url":"https://api.github.com/users/vinyll","html_url":"https://github.com/vinyll","followers_url":"https://api.github.com/users/vinyll/followers","following_url":"https://api.github.com/users/vinyll/following{/other_user}","gists_url":"https://api.github.com/users/vinyll/gists{/gist_id}","starred_url":"https://api.github.com/users/vinyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinyll/subscriptions","organizations_url":"https://api.github.com/users/vinyll/orgs","repos_url":"https://api.github.com/users/vinyll/repos","events_url":"https://api.github.com/users/vinyll/events{/privacy}","received_events_url":"https://api.github.com/users/vinyll/received_events","type":"User","site_admin":false},"assignees":[{"login":"vinyll","id":145172,"avatar_url":"https://avatars1.githubusercontent.com/u/145172?v=4","gravatar_id":"","url":"https://api.github.com/users/vinyll","html_url":"https://github.com/vinyll","followers_url":"https://api.github.com/users/vinyll/followers","following_url":"https://api.github.com/users/vinyll/following{/other_user}","gists_url":"https://api.github.com/users/vinyll/gists{/gist_id}","starred_url":"https://api.github.com/users/vinyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinyll/subscriptions","organizations_url":"https://api.github.com/users/vinyll/orgs","repos_url":"https://api.github.com/users/vinyll/repos","events_url":"https://api.github.com/users/vinyll/events{/privacy}","received_events_url":"https://api.github.com/users/vinyll/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/scopyleft/cafebabel/pulls/2/commits","review_comments_url":"https://api.github.com/repos/scopyleft/cafebabel/pulls/2/comments","review_comment_url":"https://api.github.com/repos/scopyleft/cafebabel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scopyleft/cafebabel/issues/2/comments","statuses_url":"https://api.github.com/repos/scopyleft/cafebabel/statuses/bd510ebd103ba55358ed1d9c215be25387feee0f","head":{"label":"scopyleft:user-crud","ref":"user-crud","sha":"bd510ebd103ba55358ed1d9c215be25387feee0f","user":{"login":"scopyleft","id":1841264,"avatar_url":"https://avatars1.githubusercontent.com/u/1841264?v=4","gravatar_id":"","url":"https://api.github.com/users/scopyleft","html_url":"https://github.com/scopyleft","followers_url":"https://api.github.com/users/scopyleft/followers","following_url":"https://api.github.com/users/scopyleft/following{/other_user}","gists_url":"https://api.github.com/users/scopyleft/gists{/gist_id}","starred_url":"https://api.github.com/users/scopyleft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopyleft/subscriptions","organizations_url":"https://api.github.com/users/scopyleft/orgs","repos_url":"https://api.github.com/users/scopyleft/repos","events_url":"https://api.github.com/users/scopyleft/events{/privacy}","received_events_url":"https://api.github.com/users/scopyleft/received_events","type":"Organization","site_admin":false},"repo":{"id":105559967,"name":"cafebabel","full_name":"scopyleft/cafebabel","owner":{"login":"scopyleft","id":1841264,"avatar_url":"https://avatars1.githubusercontent.com/u/1841264?v=4","gravatar_id":"","url":"https://api.github.com/users/scopyleft","html_url":"https://github.com/scopyleft","followers_url":"https://api.github.com/users/scopyleft/followers","following_url":"https://api.github.com/users/scopyleft/following{/other_user}","gists_url":"https://api.github.com/users/scopyleft/gists{/gist_id}","starred_url":"https://api.github.com/users/scopyleft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopyleft/subscriptions","organizations_url":"https://api.github.com/users/scopyleft/orgs","repos_url":"https://api.github.com/users/scopyleft/repos","events_url":"https://api.github.com/users/scopyleft/events{/privacy}","received_events_url":"https://api.github.com/users/scopyleft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scopyleft/cafebabel","description":"The future of Cafebabel","fork":false,"url":"https://api.github.com/repos/scopyleft/cafebabel","forks_url":"https://api.github.com/repos/scopyleft/cafebabel/forks","keys_url":"https://api.github.com/repos/scopyleft/cafebabel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scopyleft/cafebabel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scopyleft/cafebabel/teams","hooks_url":"https://api.github.com/repos/scopyleft/cafebabel/hooks","issue_events_url":"https://api.github.com/repos/scopyleft/cafebabel/issues/events{/number}","events_url":"https://api.github.com/repos/scopyleft/cafebabel/events","assignees_url":"https://api.github.com/repos/scopyleft/cafebabel/assignees{/user}","branches_url":"https://api.github.com/repos/scopyleft/cafebabel/branches{/branch}","tags_url":"https://api.github.com/repos/scopyleft/cafebabel/tags","blobs_url":"https://api.github.com/repos/scopyleft/cafebabel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scopyleft/cafebabel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scopyleft/cafebabel/git/refs{/sha}","trees_url":"https://api.github.com/repos/scopyleft/cafebabel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scopyleft/cafebabel/statuses/{sha}","languages_url":"https://api.github.com/repos/scopyleft/cafebabel/languages","stargazers_url":"https://api.github.com/repos/scopyleft/cafebabel/stargazers","contributors_url":"https://api.github.com/repos/scopyleft/cafebabel/contributors","subscribers_url":"https://api.github.com/repos/scopyleft/cafebabel/subscribers","subscription_url":"https://api.github.com/repos/scopyleft/cafebabel/subscription","commits_url":"https://api.github.com/repos/scopyleft/cafebabel/commits{/sha}","git_commits_url":"https://api.github.com/repos/scopyleft/cafebabel/git/commits{/sha}","comments_url":"https://api.github.com/repos/scopyleft/cafebabel/comments{/number}","issue_comment_url":"https://api.github.com/repos/scopyleft/cafebabel/issues/comments{/number}","contents_url":"https://api.github.com/repos/scopyleft/cafebabel/contents/{+path}","compare_url":"https://api.github.com/repos/scopyleft/cafebabel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scopyleft/cafebabel/merges","archive_url":"https://api.github.com/repos/scopyleft/cafebabel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scopyleft/cafebabel/downloads","issues_url":"https://api.github.com/repos/scopyleft/cafebabel/issues{/number}","pulls_url":"https://api.github.com/repos/scopyleft/cafebabel/pulls{/number}","milestones_url":"https://api.github.com/repos/scopyleft/cafebabel/milestones{/number}","notifications_url":"https://api.github.com/repos/scopyleft/cafebabel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scopyleft/cafebabel/labels{/name}","releases_url":"https://api.github.com/repos/scopyleft/cafebabel/releases{/id}","deployments_url":"https://api.github.com/repos/scopyleft/cafebabel/deployments","created_at":"2017-10-02T16:53:20Z","updated_at":"2017-10-03T13:59:12Z","pushed_at":"2017-10-03T16:32:08Z","git_url":"git://github.com/scopyleft/cafebabel.git","ssh_url":"git@github.com:scopyleft/cafebabel.git","clone_url":"https://github.com/scopyleft/cafebabel.git","svn_url":"https://github.com/scopyleft/cafebabel","homepage":null,"size":13,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"scopyleft:master","ref":"master","sha":"e4e32d2a8463059bc701856fdd824ae208133fe7","user":{"login":"scopyleft","id":1841264,"avatar_url":"https://avatars1.githubusercontent.com/u/1841264?v=4","gravatar_id":"","url":"https://api.github.com/users/scopyleft","html_url":"https://github.com/scopyleft","followers_url":"https://api.github.com/users/scopyleft/followers","following_url":"https://api.github.com/users/scopyleft/following{/other_user}","gists_url":"https://api.github.com/users/scopyleft/gists{/gist_id}","starred_url":"https://api.github.com/users/scopyleft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopyleft/subscriptions","organizations_url":"https://api.github.com/users/scopyleft/orgs","repos_url":"https://api.github.com/users/scopyleft/repos","events_url":"https://api.github.com/users/scopyleft/events{/privacy}","received_events_url":"https://api.github.com/users/scopyleft/received_events","type":"Organization","site_admin":false},"repo":{"id":105559967,"name":"cafebabel","full_name":"scopyleft/cafebabel","owner":{"login":"scopyleft","id":1841264,"avatar_url":"https://avatars1.githubusercontent.com/u/1841264?v=4","gravatar_id":"","url":"https://api.github.com/users/scopyleft","html_url":"https://github.com/scopyleft","followers_url":"https://api.github.com/users/scopyleft/followers","following_url":"https://api.github.com/users/scopyleft/following{/other_user}","gists_url":"https://api.github.com/users/scopyleft/gists{/gist_id}","starred_url":"https://api.github.com/users/scopyleft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopyleft/subscriptions","organizations_url":"https://api.github.com/users/scopyleft/orgs","repos_url":"https://api.github.com/users/scopyleft/repos","events_url":"https://api.github.com/users/scopyleft/events{/privacy}","received_events_url":"https://api.github.com/users/scopyleft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scopyleft/cafebabel","description":"The future of Cafebabel","fork":false,"url":"https://api.github.com/repos/scopyleft/cafebabel","forks_url":"https://api.github.com/repos/scopyleft/cafebabel/forks","keys_url":"https://api.github.com/repos/scopyleft/cafebabel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scopyleft/cafebabel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scopyleft/cafebabel/teams","hooks_url":"https://api.github.com/repos/scopyleft/cafebabel/hooks","issue_events_url":"https://api.github.com/repos/scopyleft/cafebabel/issues/events{/number}","events_url":"https://api.github.com/repos/scopyleft/cafebabel/events","assignees_url":"https://api.github.com/repos/scopyleft/cafebabel/assignees{/user}","branches_url":"https://api.github.com/repos/scopyleft/cafebabel/branches{/branch}","tags_url":"https://api.github.com/repos/scopyleft/cafebabel/tags","blobs_url":"https://api.github.com/repos/scopyleft/cafebabel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scopyleft/cafebabel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scopyleft/cafebabel/git/refs{/sha}","trees_url":"https://api.github.com/repos/scopyleft/cafebabel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scopyleft/cafebabel/statuses/{sha}","languages_url":"https://api.github.com/repos/scopyleft/cafebabel/languages","stargazers_url":"https://api.github.com/repos/scopyleft/cafebabel/stargazers","contributors_url":"https://api.github.com/repos/scopyleft/cafebabel/contributors","subscribers_url":"https://api.github.com/repos/scopyleft/cafebabel/subscribers","subscription_url":"https://api.github.com/repos/scopyleft/cafebabel/subscription","commits_url":"https://api.github.com/repos/scopyleft/cafebabel/commits{/sha}","git_commits_url":"https://api.github.com/repos/scopyleft/cafebabel/git/commits{/sha}","comments_url":"https://api.github.com/repos/scopyleft/cafebabel/comments{/number}","issue_comment_url":"https://api.github.com/repos/scopyleft/cafebabel/issues/comments{/number}","contents_url":"https://api.github.com/repos/scopyleft/cafebabel/contents/{+path}","compare_url":"https://api.github.com/repos/scopyleft/cafebabel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scopyleft/cafebabel/merges","archive_url":"https://api.github.com/repos/scopyleft/cafebabel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scopyleft/cafebabel/downloads","issues_url":"https://api.github.com/repos/scopyleft/cafebabel/issues{/number}","pulls_url":"https://api.github.com/repos/scopyleft/cafebabel/pulls{/number}","milestones_url":"https://api.github.com/repos/scopyleft/cafebabel/milestones{/number}","notifications_url":"https://api.github.com/repos/scopyleft/cafebabel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scopyleft/cafebabel/labels{/name}","releases_url":"https://api.github.com/repos/scopyleft/cafebabel/releases{/id}","deployments_url":"https://api.github.com/repos/scopyleft/cafebabel/deployments","created_at":"2017-10-02T16:53:20Z","updated_at":"2017-10-03T13:59:12Z","pushed_at":"2017-10-03T16:32:08Z","git_url":"git://github.com/scopyleft/cafebabel.git","ssh_url":"git@github.com:scopyleft/cafebabel.git","clone_url":"https://github.com/scopyleft/cafebabel.git","svn_url":"https://github.com/scopyleft/cafebabel","homepage":null,"size":13,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scopyleft/cafebabel/pulls/2"},"html":{"href":"https://github.com/scopyleft/cafebabel/pull/2"},"issue":{"href":"https://api.github.com/repos/scopyleft/cafebabel/issues/2"},"comments":{"href":"https://api.github.com/repos/scopyleft/cafebabel/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/scopyleft/cafebabel/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/scopyleft/cafebabel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scopyleft/cafebabel/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/scopyleft/cafebabel/statuses/bd510ebd103ba55358ed1d9c215be25387feee0f"}},"author_association":"OWNER"}}
{"actor":{"display_login":"vinyll"}}