{"action":"created","comment":{"url":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/comments/198375485","pull_request_review_id":132294197,"id":198375485,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODM3NTQ4NQ==","diff_hunk":"@@ -496,6 +516,76 @@ class ObservationEditor extends React.Component<\n     }\n   };\n \n+  observationExists = () => {\n+    const { observations, selectedObservation } = this.props;\n+\n+    if (selectedObservation && observations) {\n+      if (observations.find(o => o.id === selectedObservation.id)) {\n+        return true;\n+      }\n+    }\n+\n+    return false;\n+  };\n+\n+  allowEditing = (index: number) => {\n+    const allowEdit =\n+      !this.observationExists() ||\n+      (this.observationExists() && index >= this.state.numExistingPhotos);\n+\n+    return allowEdit;\n+  };\n+\n+  hasEdits = () => {\n+    const { selectedObservation } = this.props;\n+    const {\n+      numExistingPhotos,\n+      existingNotes,\n+      numExistingFieldsAnswered,\n+      text\n+    } = this.state;\n+\n+    if (selectedObservation) {\n+      if (this.observationExists()) {\n+        const currentFieldsAnswered = selectedObservation.fields.filter(\n+          field => field.answered\n+        ).length;\n+\n+        const hasEdits =\n+          selectedObservation.media.length !== numExistingPhotos ||\n+          text !== existingNotes ||\n+          currentFieldsAnswered !== numExistingFieldsAnswered;\n+\n+        return hasEdits;\n+      }\n+      const hasFieldAnswered = !!selectedObservation.fields.find(\n+        field => field.answered\n+      );\n+      const noEdits =\n+        selectedObservation &&\n+        selectedObservation.media.length === 0 &&\n+        selectedObservation.notes === '' &&\n+        !hasFieldAnswered;\n+\n+      return !noEdits;\n+    }\n+\n+    return false;\n+  };\n+\n+  handleCancel = () => {\n+    const { navigation, observationSource, showCancelModal } = this.props;\n+    if (this.hasEdits()) {\n+      showCancelModal();\n+    } else if (observationSource === 'map') {\n+      navigation.navigate({","path":"src/components/Views/ObservationEditor/ObservationEditor.js","position":108,"original_position":108,"commit_id":"7814395493686c92b401468b2883d3491ee56619","original_commit_id":"7814395493686c92b401468b2883d3491ee56619","user":{"login":"czengg","id":2938042,"node_id":"MDQ6VXNlcjI5MzgwNDI=","avatar_url":"https://avatars2.githubusercontent.com/u/2938042?v=4","gravatar_id":"","url":"https://api.github.com/users/czengg","html_url":"https://github.com/czengg","followers_url":"https://api.github.com/users/czengg/followers","following_url":"https://api.github.com/users/czengg/following{/other_user}","gists_url":"https://api.github.com/users/czengg/gists{/gist_id}","starred_url":"https://api.github.com/users/czengg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czengg/subscriptions","organizations_url":"https://api.github.com/users/czengg/orgs","repos_url":"https://api.github.com/users/czengg/repos","events_url":"https://api.github.com/users/czengg/events{/privacy}","received_events_url":"https://api.github.com/users/czengg/received_events","type":"User","site_admin":false},"body":"Oh never mind, I thought this was the cancel to go back button. This should be fine\r\n","created_at":"2018-06-27T06:03:31Z","updated_at":"2018-06-27T06:03:31Z","html_url":"https://github.com/digidem/mapeo-mobile/pull/65#discussion_r198375485","pull_request_url":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/65","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/comments/198375485"},"html":{"href":"https://github.com/digidem/mapeo-mobile/pull/65#discussion_r198375485"},"pull_request":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/65"}},"in_reply_to_id":198373705},"pull_request":{"url":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/65","id":197617342,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3NjE3MzQy","html_url":"https://github.com/digidem/mapeo-mobile/pull/65","diff_url":"https://github.com/digidem/mapeo-mobile/pull/65.diff","patch_url":"https://github.com/digidem/mapeo-mobile/pull/65.patch","issue_url":"https://api.github.com/repos/digidem/mapeo-mobile/issues/65","number":65,"state":"open","locked":false,"title":"Bugs/june w4 helena","user":{"login":"howdyitshelena","id":2066060,"node_id":"MDQ6VXNlcjIwNjYwNjA=","avatar_url":"https://avatars2.githubusercontent.com/u/2066060?v=4","gravatar_id":"","url":"https://api.github.com/users/howdyitshelena","html_url":"https://github.com/howdyitshelena","followers_url":"https://api.github.com/users/howdyitshelena/followers","following_url":"https://api.github.com/users/howdyitshelena/following{/other_user}","gists_url":"https://api.github.com/users/howdyitshelena/gists{/gist_id}","starred_url":"https://api.github.com/users/howdyitshelena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/howdyitshelena/subscriptions","organizations_url":"https://api.github.com/users/howdyitshelena/orgs","repos_url":"https://api.github.com/users/howdyitshelena/repos","events_url":"https://api.github.com/users/howdyitshelena/events{/privacy}","received_events_url":"https://api.github.com/users/howdyitshelena/received_events","type":"User","site_admin":false},"body":"- Only show cancel modal when changes have been made in editor\r\n- Don't allow deletion of existing photos in editor\r\n- Fix camera navigation when creating an observation from camera","created_at":"2018-06-27T05:06:42Z","updated_at":"2018-06-27T06:03:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f58916d5c97c5152f72c5705aca98f75a7d11fe9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/65/commits","review_comments_url":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/65/comments","review_comment_url":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/digidem/mapeo-mobile/issues/65/comments","statuses_url":"https://api.github.com/repos/digidem/mapeo-mobile/statuses/7814395493686c92b401468b2883d3491ee56619","head":{"label":"digidem:bugs/june-w4-helena","ref":"bugs/june-w4-helena","sha":"7814395493686c92b401468b2883d3491ee56619","user":{"login":"digidem","id":405221,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNTIyMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/405221?v=4","gravatar_id":"","url":"https://api.github.com/users/digidem","html_url":"https://github.com/digidem","followers_url":"https://api.github.com/users/digidem/followers","following_url":"https://api.github.com/users/digidem/following{/other_user}","gists_url":"https://api.github.com/users/digidem/gists{/gist_id}","starred_url":"https://api.github.com/users/digidem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digidem/subscriptions","organizations_url":"https://api.github.com/users/digidem/orgs","repos_url":"https://api.github.com/users/digidem/repos","events_url":"https://api.github.com/users/digidem/events{/privacy}","received_events_url":"https://api.github.com/users/digidem/received_events","type":"Organization","site_admin":false},"repo":{"id":43975096,"node_id":"MDEwOlJlcG9zaXRvcnk0Mzk3NTA5Ng==","name":"mapeo-mobile","full_name":"digidem/mapeo-mobile","owner":{"login":"digidem","id":405221,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNTIyMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/405221?v=4","gravatar_id":"","url":"https://api.github.com/users/digidem","html_url":"https://github.com/digidem","followers_url":"https://api.github.com/users/digidem/followers","following_url":"https://api.github.com/users/digidem/following{/other_user}","gists_url":"https://api.github.com/users/digidem/gists{/gist_id}","starred_url":"https://api.github.com/users/digidem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digidem/subscriptions","organizations_url":"https://api.github.com/users/digidem/orgs","repos_url":"https://api.github.com/users/digidem/repos","events_url":"https://api.github.com/users/digidem/events{/privacy}","received_events_url":"https://api.github.com/users/digidem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digidem/mapeo-mobile","description":"Monitor and document the world around you","fork":false,"url":"https://api.github.com/repos/digidem/mapeo-mobile","forks_url":"https://api.github.com/repos/digidem/mapeo-mobile/forks","keys_url":"https://api.github.com/repos/digidem/mapeo-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digidem/mapeo-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digidem/mapeo-mobile/teams","hooks_url":"https://api.github.com/repos/digidem/mapeo-mobile/hooks","issue_events_url":"https://api.github.com/repos/digidem/mapeo-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/digidem/mapeo-mobile/events","assignees_url":"https://api.github.com/repos/digidem/mapeo-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/digidem/mapeo-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/digidem/mapeo-mobile/tags","blobs_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digidem/mapeo-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/digidem/mapeo-mobile/languages","stargazers_url":"https://api.github.com/repos/digidem/mapeo-mobile/stargazers","contributors_url":"https://api.github.com/repos/digidem/mapeo-mobile/contributors","subscribers_url":"https://api.github.com/repos/digidem/mapeo-mobile/subscribers","subscription_url":"https://api.github.com/repos/digidem/mapeo-mobile/subscription","commits_url":"https://api.github.com/repos/digidem/mapeo-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/digidem/mapeo-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/digidem/mapeo-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/digidem/mapeo-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/digidem/mapeo-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digidem/mapeo-mobile/merges","archive_url":"https://api.github.com/repos/digidem/mapeo-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digidem/mapeo-mobile/downloads","issues_url":"https://api.github.com/repos/digidem/mapeo-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/digidem/mapeo-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/digidem/mapeo-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/digidem/mapeo-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digidem/mapeo-mobile/labels{/name}","releases_url":"https://api.github.com/repos/digidem/mapeo-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/digidem/mapeo-mobile/deployments","created_at":"2015-10-09T19:11:33Z","updated_at":"2018-06-25T07:04:01Z","pushed_at":"2018-06-27T05:25:15Z","git_url":"git://github.com/digidem/mapeo-mobile.git","ssh_url":"git@github.com:digidem/mapeo-mobile.git","clone_url":"https://github.com/digidem/mapeo-mobile.git","svn_url":"https://github.com/digidem/mapeo-mobile","homepage":"","size":13663,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":9,"watchers":4,"default_branch":"master"}},"base":{"label":"digidem:develop","ref":"develop","sha":"074602220ff368c739e19ef5f04ef269b7f7f007","user":{"login":"digidem","id":405221,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNTIyMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/405221?v=4","gravatar_id":"","url":"https://api.github.com/users/digidem","html_url":"https://github.com/digidem","followers_url":"https://api.github.com/users/digidem/followers","following_url":"https://api.github.com/users/digidem/following{/other_user}","gists_url":"https://api.github.com/users/digidem/gists{/gist_id}","starred_url":"https://api.github.com/users/digidem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digidem/subscriptions","organizations_url":"https://api.github.com/users/digidem/orgs","repos_url":"https://api.github.com/users/digidem/repos","events_url":"https://api.github.com/users/digidem/events{/privacy}","received_events_url":"https://api.github.com/users/digidem/received_events","type":"Organization","site_admin":false},"repo":{"id":43975096,"node_id":"MDEwOlJlcG9zaXRvcnk0Mzk3NTA5Ng==","name":"mapeo-mobile","full_name":"digidem/mapeo-mobile","owner":{"login":"digidem","id":405221,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNTIyMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/405221?v=4","gravatar_id":"","url":"https://api.github.com/users/digidem","html_url":"https://github.com/digidem","followers_url":"https://api.github.com/users/digidem/followers","following_url":"https://api.github.com/users/digidem/following{/other_user}","gists_url":"https://api.github.com/users/digidem/gists{/gist_id}","starred_url":"https://api.github.com/users/digidem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digidem/subscriptions","organizations_url":"https://api.github.com/users/digidem/orgs","repos_url":"https://api.github.com/users/digidem/repos","events_url":"https://api.github.com/users/digidem/events{/privacy}","received_events_url":"https://api.github.com/users/digidem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/digidem/mapeo-mobile","description":"Monitor and document the world around you","fork":false,"url":"https://api.github.com/repos/digidem/mapeo-mobile","forks_url":"https://api.github.com/repos/digidem/mapeo-mobile/forks","keys_url":"https://api.github.com/repos/digidem/mapeo-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digidem/mapeo-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digidem/mapeo-mobile/teams","hooks_url":"https://api.github.com/repos/digidem/mapeo-mobile/hooks","issue_events_url":"https://api.github.com/repos/digidem/mapeo-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/digidem/mapeo-mobile/events","assignees_url":"https://api.github.com/repos/digidem/mapeo-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/digidem/mapeo-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/digidem/mapeo-mobile/tags","blobs_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digidem/mapeo-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/digidem/mapeo-mobile/languages","stargazers_url":"https://api.github.com/repos/digidem/mapeo-mobile/stargazers","contributors_url":"https://api.github.com/repos/digidem/mapeo-mobile/contributors","subscribers_url":"https://api.github.com/repos/digidem/mapeo-mobile/subscribers","subscription_url":"https://api.github.com/repos/digidem/mapeo-mobile/subscription","commits_url":"https://api.github.com/repos/digidem/mapeo-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/digidem/mapeo-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/digidem/mapeo-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/digidem/mapeo-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/digidem/mapeo-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/digidem/mapeo-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digidem/mapeo-mobile/merges","archive_url":"https://api.github.com/repos/digidem/mapeo-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digidem/mapeo-mobile/downloads","issues_url":"https://api.github.com/repos/digidem/mapeo-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/digidem/mapeo-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/digidem/mapeo-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/digidem/mapeo-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digidem/mapeo-mobile/labels{/name}","releases_url":"https://api.github.com/repos/digidem/mapeo-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/digidem/mapeo-mobile/deployments","created_at":"2015-10-09T19:11:33Z","updated_at":"2018-06-25T07:04:01Z","pushed_at":"2018-06-27T05:25:15Z","git_url":"git://github.com/digidem/mapeo-mobile.git","ssh_url":"git@github.com:digidem/mapeo-mobile.git","clone_url":"https://github.com/digidem/mapeo-mobile.git","svn_url":"https://github.com/digidem/mapeo-mobile","homepage":"","size":13663,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":9,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/65"},"html":{"href":"https://github.com/digidem/mapeo-mobile/pull/65"},"issue":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/issues/65"},"comments":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/digidem/mapeo-mobile/statuses/7814395493686c92b401468b2883d3491ee56619"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"czengg"}}