{"action":"created","comment":{"url":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/comments/197580084","pull_request_review_id":131359835,"id":197580084,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzU4MDA4NA==","diff_hunk":"@@ -0,0 +1,106 @@\n+/**\n+ * Set the invite_confirmed field on all members.\n+ */\n+\n+import * as path from \"path\";\n+\n+import * as admin from \"firebase-admin\";\n+import {\n+  Firestore,\n+  QueryDocumentSnapshot,\n+  DocumentSnapshot\n+} from \"@google-cloud/firestore\";\n+\n+import { getDb } from \"./helpers\";\n+import { request } from \"http\";\n+\n+async function setIsInviteConfirmed(db: Firestore) {\n+  const members = (await db.collection(\"members\").get()).docs;\n+  const inviteOperations = (await db\n+    .collection(\"operations\")\n+    .where(\"op_code\", \"==\", \"REQUEST_INVITE\")\n+    .get()).docs;\n+  const trustOperations = (await db\n+    .collection(\"operations\")\n+    .where(\"op_code\", \"==\", \"TRUST\")\n+    .get()).docs;\n+\n+  for (const i in members) {\n+    const member = members[i];\n+\n+    const inviteOps = inviteOperations.filter(\n+      op => op.get(\"creator_uid\") === member.id\n+    );\n+    if (inviteOps.length < 1) {\n+      console.log(\n+        \"member has zero request invite ops\",\n+        member.id,\n+        inviteOps.length\n+      );\n+      continue;\n+    } else if (inviteOps.length > 1) {","path":"migrations/2018-06-22-01-member-invite-confirmed.ts","position":41,"original_position":41,"commit_id":"3c8f6936a633fafb9719fd69fa26bd9fccd84f62","original_commit_id":"3c8f6936a633fafb9719fd69fa26bd9fccd84f62","user":{"login":"osdiab","id":1890926,"node_id":"MDQ6VXNlcjE4OTA5MjY=","avatar_url":"https://avatars0.githubusercontent.com/u/1890926?v=4","gravatar_id":"","url":"https://api.github.com/users/osdiab","html_url":"https://github.com/osdiab","followers_url":"https://api.github.com/users/osdiab/followers","following_url":"https://api.github.com/users/osdiab/following{/other_user}","gists_url":"https://api.github.com/users/osdiab/gists{/gist_id}","starred_url":"https://api.github.com/users/osdiab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osdiab/subscriptions","organizations_url":"https://api.github.com/users/osdiab/orgs","repos_url":"https://api.github.com/users/osdiab/repos","events_url":"https://api.github.com/users/osdiab/events{/privacy}","received_events_url":"https://api.github.com/users/osdiab/received_events","type":"User","site_admin":false},"body":"Are we just skipping these? why?","created_at":"2018-06-22T22:04:47Z","updated_at":"2018-06-22T22:06:30Z","html_url":"https://github.com/rahafoundation/firebase-backup/pull/21#discussion_r197580084","pull_request_url":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/21","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/comments/197580084"},"html":{"href":"https://github.com/rahafoundation/firebase-backup/pull/21#discussion_r197580084"},"pull_request":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/21","id":196851888,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2ODUxODg4","html_url":"https://github.com/rahafoundation/firebase-backup/pull/21","diff_url":"https://github.com/rahafoundation/firebase-backup/pull/21.diff","patch_url":"https://github.com/rahafoundation/firebase-backup/pull/21.patch","issue_url":"https://api.github.com/repos/rahafoundation/firebase-backup/issues/21","number":21,"state":"open","locked":false,"title":"Migration to add invite confirmed field.","user":{"login":"rahulgi","id":2237985,"node_id":"MDQ6VXNlcjIyMzc5ODU=","avatar_url":"https://avatars1.githubusercontent.com/u/2237985?v=4","gravatar_id":"","url":"https://api.github.com/users/rahulgi","html_url":"https://github.com/rahulgi","followers_url":"https://api.github.com/users/rahulgi/followers","following_url":"https://api.github.com/users/rahulgi/following{/other_user}","gists_url":"https://api.github.com/users/rahulgi/gists{/gist_id}","starred_url":"https://api.github.com/users/rahulgi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahulgi/subscriptions","organizations_url":"https://api.github.com/users/rahulgi/orgs","repos_url":"https://api.github.com/users/rahulgi/repos","events_url":"https://api.github.com/users/rahulgi/events{/privacy}","received_events_url":"https://api.github.com/users/rahulgi/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-22T21:42:42Z","updated_at":"2018-06-22T22:06:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f50ab52867bddb7f91f9974b128af9bfc906e632","assignee":null,"assignees":[],"requested_reviewers":[{"login":"tinaroh","id":1296389,"node_id":"MDQ6VXNlcjEyOTYzODk=","avatar_url":"https://avatars3.githubusercontent.com/u/1296389?v=4","gravatar_id":"","url":"https://api.github.com/users/tinaroh","html_url":"https://github.com/tinaroh","followers_url":"https://api.github.com/users/tinaroh/followers","following_url":"https://api.github.com/users/tinaroh/following{/other_user}","gists_url":"https://api.github.com/users/tinaroh/gists{/gist_id}","starred_url":"https://api.github.com/users/tinaroh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinaroh/subscriptions","organizations_url":"https://api.github.com/users/tinaroh/orgs","repos_url":"https://api.github.com/users/tinaroh/repos","events_url":"https://api.github.com/users/tinaroh/events{/privacy}","received_events_url":"https://api.github.com/users/tinaroh/received_events","type":"User","site_admin":false},{"login":"markulrich","id":6357579,"node_id":"MDQ6VXNlcjYzNTc1Nzk=","avatar_url":"https://avatars3.githubusercontent.com/u/6357579?v=4","gravatar_id":"","url":"https://api.github.com/users/markulrich","html_url":"https://github.com/markulrich","followers_url":"https://api.github.com/users/markulrich/followers","following_url":"https://api.github.com/users/markulrich/following{/other_user}","gists_url":"https://api.github.com/users/markulrich/gists{/gist_id}","starred_url":"https://api.github.com/users/markulrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markulrich/subscriptions","organizations_url":"https://api.github.com/users/markulrich/orgs","repos_url":"https://api.github.com/users/markulrich/repos","events_url":"https://api.github.com/users/markulrich/events{/privacy}","received_events_url":"https://api.github.com/users/markulrich/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/21/commits","review_comments_url":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/21/comments","review_comment_url":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rahafoundation/firebase-backup/issues/21/comments","statuses_url":"https://api.github.com/repos/rahafoundation/firebase-backup/statuses/3c8f6936a633fafb9719fd69fa26bd9fccd84f62","head":{"label":"rahafoundation:rg-migration-add-is-invite-confirmed-field","ref":"rg-migration-add-is-invite-confirmed-field","sha":"3c8f6936a633fafb9719fd69fa26bd9fccd84f62","user":{"login":"rahafoundation","id":35645362,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NjQ1MzYy","avatar_url":"https://avatars1.githubusercontent.com/u/35645362?v=4","gravatar_id":"","url":"https://api.github.com/users/rahafoundation","html_url":"https://github.com/rahafoundation","followers_url":"https://api.github.com/users/rahafoundation/followers","following_url":"https://api.github.com/users/rahafoundation/following{/other_user}","gists_url":"https://api.github.com/users/rahafoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/rahafoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahafoundation/subscriptions","organizations_url":"https://api.github.com/users/rahafoundation/orgs","repos_url":"https://api.github.com/users/rahafoundation/repos","events_url":"https://api.github.com/users/rahafoundation/events{/privacy}","received_events_url":"https://api.github.com/users/rahafoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":124501041,"node_id":"MDEwOlJlcG9zaXRvcnkxMjQ1MDEwNDE=","name":"firebase-backup","full_name":"rahafoundation/firebase-backup","owner":{"login":"rahafoundation","id":35645362,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NjQ1MzYy","avatar_url":"https://avatars1.githubusercontent.com/u/35645362?v=4","gravatar_id":"","url":"https://api.github.com/users/rahafoundation","html_url":"https://github.com/rahafoundation","followers_url":"https://api.github.com/users/rahafoundation/followers","following_url":"https://api.github.com/users/rahafoundation/following{/other_user}","gists_url":"https://api.github.com/users/rahafoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/rahafoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahafoundation/subscriptions","organizations_url":"https://api.github.com/users/rahafoundation/orgs","repos_url":"https://api.github.com/users/rahafoundation/repos","events_url":"https://api.github.com/users/rahafoundation/events{/privacy}","received_events_url":"https://api.github.com/users/rahafoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rahafoundation/firebase-backup","description":"backup tool for raha db","fork":false,"url":"https://api.github.com/repos/rahafoundation/firebase-backup","forks_url":"https://api.github.com/repos/rahafoundation/firebase-backup/forks","keys_url":"https://api.github.com/repos/rahafoundation/firebase-backup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rahafoundation/firebase-backup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rahafoundation/firebase-backup/teams","hooks_url":"https://api.github.com/repos/rahafoundation/firebase-backup/hooks","issue_events_url":"https://api.github.com/repos/rahafoundation/firebase-backup/issues/events{/number}","events_url":"https://api.github.com/repos/rahafoundation/firebase-backup/events","assignees_url":"https://api.github.com/repos/rahafoundation/firebase-backup/assignees{/user}","branches_url":"https://api.github.com/repos/rahafoundation/firebase-backup/branches{/branch}","tags_url":"https://api.github.com/repos/rahafoundation/firebase-backup/tags","blobs_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/refs{/sha}","trees_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rahafoundation/firebase-backup/statuses/{sha}","languages_url":"https://api.github.com/repos/rahafoundation/firebase-backup/languages","stargazers_url":"https://api.github.com/repos/rahafoundation/firebase-backup/stargazers","contributors_url":"https://api.github.com/repos/rahafoundation/firebase-backup/contributors","subscribers_url":"https://api.github.com/repos/rahafoundation/firebase-backup/subscribers","subscription_url":"https://api.github.com/repos/rahafoundation/firebase-backup/subscription","commits_url":"https://api.github.com/repos/rahafoundation/firebase-backup/commits{/sha}","git_commits_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/commits{/sha}","comments_url":"https://api.github.com/repos/rahafoundation/firebase-backup/comments{/number}","issue_comment_url":"https://api.github.com/repos/rahafoundation/firebase-backup/issues/comments{/number}","contents_url":"https://api.github.com/repos/rahafoundation/firebase-backup/contents/{+path}","compare_url":"https://api.github.com/repos/rahafoundation/firebase-backup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rahafoundation/firebase-backup/merges","archive_url":"https://api.github.com/repos/rahafoundation/firebase-backup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rahafoundation/firebase-backup/downloads","issues_url":"https://api.github.com/repos/rahafoundation/firebase-backup/issues{/number}","pulls_url":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls{/number}","milestones_url":"https://api.github.com/repos/rahafoundation/firebase-backup/milestones{/number}","notifications_url":"https://api.github.com/repos/rahafoundation/firebase-backup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rahafoundation/firebase-backup/labels{/name}","releases_url":"https://api.github.com/repos/rahafoundation/firebase-backup/releases{/id}","deployments_url":"https://api.github.com/repos/rahafoundation/firebase-backup/deployments","created_at":"2018-03-09T06:58:17Z","updated_at":"2018-06-22T21:41:55Z","pushed_at":"2018-06-22T21:42:43Z","git_url":"git://github.com/rahafoundation/firebase-backup.git","ssh_url":"git@github.com:rahafoundation/firebase-backup.git","clone_url":"https://github.com/rahafoundation/firebase-backup.git","svn_url":"https://github.com/rahafoundation/firebase-backup","homepage":null,"size":110,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":1,"default_branch":"master"}},"base":{"label":"rahafoundation:rg-migration-standardize-request-invite-from-uid-fieldname","ref":"rg-migration-standardize-request-invite-from-uid-fieldname","sha":"cdf63571be8b87fb3953e690506d9b6910ee2538","user":{"login":"rahafoundation","id":35645362,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NjQ1MzYy","avatar_url":"https://avatars1.githubusercontent.com/u/35645362?v=4","gravatar_id":"","url":"https://api.github.com/users/rahafoundation","html_url":"https://github.com/rahafoundation","followers_url":"https://api.github.com/users/rahafoundation/followers","following_url":"https://api.github.com/users/rahafoundation/following{/other_user}","gists_url":"https://api.github.com/users/rahafoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/rahafoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahafoundation/subscriptions","organizations_url":"https://api.github.com/users/rahafoundation/orgs","repos_url":"https://api.github.com/users/rahafoundation/repos","events_url":"https://api.github.com/users/rahafoundation/events{/privacy}","received_events_url":"https://api.github.com/users/rahafoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":124501041,"node_id":"MDEwOlJlcG9zaXRvcnkxMjQ1MDEwNDE=","name":"firebase-backup","full_name":"rahafoundation/firebase-backup","owner":{"login":"rahafoundation","id":35645362,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NjQ1MzYy","avatar_url":"https://avatars1.githubusercontent.com/u/35645362?v=4","gravatar_id":"","url":"https://api.github.com/users/rahafoundation","html_url":"https://github.com/rahafoundation","followers_url":"https://api.github.com/users/rahafoundation/followers","following_url":"https://api.github.com/users/rahafoundation/following{/other_user}","gists_url":"https://api.github.com/users/rahafoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/rahafoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahafoundation/subscriptions","organizations_url":"https://api.github.com/users/rahafoundation/orgs","repos_url":"https://api.github.com/users/rahafoundation/repos","events_url":"https://api.github.com/users/rahafoundation/events{/privacy}","received_events_url":"https://api.github.com/users/rahafoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rahafoundation/firebase-backup","description":"backup tool for raha db","fork":false,"url":"https://api.github.com/repos/rahafoundation/firebase-backup","forks_url":"https://api.github.com/repos/rahafoundation/firebase-backup/forks","keys_url":"https://api.github.com/repos/rahafoundation/firebase-backup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rahafoundation/firebase-backup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rahafoundation/firebase-backup/teams","hooks_url":"https://api.github.com/repos/rahafoundation/firebase-backup/hooks","issue_events_url":"https://api.github.com/repos/rahafoundation/firebase-backup/issues/events{/number}","events_url":"https://api.github.com/repos/rahafoundation/firebase-backup/events","assignees_url":"https://api.github.com/repos/rahafoundation/firebase-backup/assignees{/user}","branches_url":"https://api.github.com/repos/rahafoundation/firebase-backup/branches{/branch}","tags_url":"https://api.github.com/repos/rahafoundation/firebase-backup/tags","blobs_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/refs{/sha}","trees_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rahafoundation/firebase-backup/statuses/{sha}","languages_url":"https://api.github.com/repos/rahafoundation/firebase-backup/languages","stargazers_url":"https://api.github.com/repos/rahafoundation/firebase-backup/stargazers","contributors_url":"https://api.github.com/repos/rahafoundation/firebase-backup/contributors","subscribers_url":"https://api.github.com/repos/rahafoundation/firebase-backup/subscribers","subscription_url":"https://api.github.com/repos/rahafoundation/firebase-backup/subscription","commits_url":"https://api.github.com/repos/rahafoundation/firebase-backup/commits{/sha}","git_commits_url":"https://api.github.com/repos/rahafoundation/firebase-backup/git/commits{/sha}","comments_url":"https://api.github.com/repos/rahafoundation/firebase-backup/comments{/number}","issue_comment_url":"https://api.github.com/repos/rahafoundation/firebase-backup/issues/comments{/number}","contents_url":"https://api.github.com/repos/rahafoundation/firebase-backup/contents/{+path}","compare_url":"https://api.github.com/repos/rahafoundation/firebase-backup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rahafoundation/firebase-backup/merges","archive_url":"https://api.github.com/repos/rahafoundation/firebase-backup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rahafoundation/firebase-backup/downloads","issues_url":"https://api.github.com/repos/rahafoundation/firebase-backup/issues{/number}","pulls_url":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls{/number}","milestones_url":"https://api.github.com/repos/rahafoundation/firebase-backup/milestones{/number}","notifications_url":"https://api.github.com/repos/rahafoundation/firebase-backup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rahafoundation/firebase-backup/labels{/name}","releases_url":"https://api.github.com/repos/rahafoundation/firebase-backup/releases{/id}","deployments_url":"https://api.github.com/repos/rahafoundation/firebase-backup/deployments","created_at":"2018-03-09T06:58:17Z","updated_at":"2018-06-22T21:41:55Z","pushed_at":"2018-06-22T21:42:43Z","git_url":"git://github.com/rahafoundation/firebase-backup.git","ssh_url":"git@github.com:rahafoundation/firebase-backup.git","clone_url":"https://github.com/rahafoundation/firebase-backup.git","svn_url":"https://github.com/rahafoundation/firebase-backup","homepage":null,"size":110,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/21"},"html":{"href":"https://github.com/rahafoundation/firebase-backup/pull/21"},"issue":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/issues/21"},"comments":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/rahafoundation/firebase-backup/statuses/3c8f6936a633fafb9719fd69fa26bd9fccd84f62"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"osdiab"}}