GitHub PullRequestReviewCommentEvent at 2014-09-12 09:20:27
Repository: h
Actor: aron
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/hypothesis/h/pulls/comments/17470050","id":17470050,"diff_hunk":"@@ -13,252 +8,206 @@ extractURIComponent = (uri, component) ->\n   extractURIComponent.a[component]\n \n \n-class Annotation\n-  this.$inject = [\n-    '$element', '$location', '$rootScope', '$sce', '$scope', '$timeout',\n-    '$window',\n-    'annotator', 'documentHelpers', 'drafts'\n-  ]\n-  constructor: (\n-     $element,   $location,   $rootScope,   $sce,   $scope,   $timeout,\n-     $window,\n-     annotator,   documentHelpers,   drafts\n-  ) ->\n-    model = $scope.model\n-    {plugins, threading} = annotator\n-\n-    $scope.action = 'create'\n-    $scope.editing = false\n-    $scope.preview = 'no'\n-\n-    if model.document and model.target.length\n-      domain = extractURIComponent(model.uri, 'hostname')\n-\n-      title = model.document.title or domain\n-      if title.length > 30\n-        title = title.slice(0, 30) + '…'\n-\n-      $scope.document =\n-        uri: model.uri\n-        domain: domain\n-        title: title\n-\n-    $scope.cancel = ($event) ->\n-      $event?.stopPropagation()\n-      $scope.editing = false\n-      drafts.remove $scope.model\n-\n-      switch $scope.action\n-        when 'create'\n-          annotator.deleteAnnotation $scope.model\n-        else\n-          $scope.model.text = $scope.origText\n-          $scope.model.tags = $scope.origTags\n-          $scope.action = 'create'\n-\n-    $scope.save = ($event) ->\n-      $event?.stopPropagation()\n-      annotation = $scope.model\n-\n-      # Forbid saving comments without a body (text or tags)\n-      if annotator.isComment(annotation) and not annotation.text and\n-      not annotation.tags?.length\n-        $window.alert \"You can not add a comment without adding some text, or at least a tag.\"\n-        return\n-\n-      # Forbid the publishing of annotations\n-      # without a body (text or tags)\n-      if $scope.form.privacy.$viewValue is \"Public\" and\n-          $scope.action isnt \"delete\" and\n-          not annotation.text and not annotation.tags?.length\n-        $window.alert \"You can not make this annotation public without adding some text, or at least a tag.\"\n-        return\n-\n-      $scope.rebuildHighlightText()\n-\n-      $scope.editing = false\n-      drafts.remove annotation\n-\n-      switch $scope.action\n-        when 'create'\n-          # First, focus on the newly created annotation\n-          unless annotator.isReply annotation\n-            $rootScope.focus annotation, true\n-\n-          if annotator.isComment(annotation) and\n-              $rootScope.viewState.view isnt \"Comments\"\n-            $rootScope.applyView \"Comments\"\n-          else if not annotator.isReply(annotation) and\n-              $rootScope.viewState.view not in [\"Document\", \"Selection\"]\n-            $rootScope.applyView \"Screen\"\n-          annotator.publish 'annotationCreated', annotation\n-        when 'delete'\n-          root = $scope.$root.annotations\n-          root = (a for a in root when a isnt root)\n-          annotation.deleted = true\n-          unless annotation.text? then annotation.text = ''\n-          annotator.updateAnnotation annotation\n-        else\n-          annotator.updateAnnotation annotation\n-\n-    $scope.reply = ($event) ->\n-      $event?.stopPropagation()\n-      unless plugins.Auth? and plugins.Auth.haveValidToken()\n-        $window.alert \"In order to reply, you need to sign in.\"\n-        return\n-\n-      references =\n-        if $scope.thread.message.references\n-          [$scope.thread.message.references..., $scope.thread.message.id]\n-        else\n-          [$scope.thread.message.id]\n-\n-      reply =\n-        references: references\n-        uri: $scope.thread.message.uri\n-\n-      annotator.publish 'beforeAnnotationCreated', [reply]\n-      drafts.add reply\n-      return\n-\n-    $scope.edit = ($event) ->\n-      $event?.stopPropagation()\n-      $scope.action = 'edit'\n-      $scope.editing = true\n-      $scope.origText = $scope.model.text\n-      $scope.origTags = $scope.model.tags\n-      drafts.add $scope.model, -> $scope.cancel()\n-      return\n-\n-    $scope.delete = ($event) ->\n-      $event?.stopPropagation()\n-      replies = $scope.thread.children?.length or 0\n-\n-      # We can delete the annotation if it hasn't got any replies or it is\n-      # private. Otherwise, we ask for a redaction message.\n-      if replies == 0 or $scope.form.privacy.$viewValue is 'Private'\n-        # If we're deleting it without asking for a message, confirm first.\n-        if confirm \"Are you sure you want to delete this annotation?\"\n-          if $scope.form.privacy.$viewValue is 'Private' and replies\n-            #Cascade delete its children\n-            for reply in $scope.thread.flattenChildren()\n-              if plugins?.Permissions?.authorize 'delete', reply\n-                annotator.deleteAnnotation reply\n-\n-          annotator.deleteAnnotation $scope.model\n+# Validate an annotation.\n+# A public annotation is valid only if they have a body.\n+# A non-public annotation requires only a target (e.g. a highlight).\n+validate = (value) ->\n+  return unless angular.isObject value\n+  worldReadable = 'group:__world__' in (value.permissions?.read or [])\n+  (value.tags?.length or value.text?.length) or\n+  (value.target?.length and not worldReadable)","path":"h/static/scripts/directives/annotation.coffee","position":155,"original_position":155,"commit_id":"765023f9f929562c4920d4fdc7467320a709185a","original_commit_id":"765023f9f929562c4920d4fdc7467320a709185a","user":{"login":"aron","id":47144,"avatar_url":"https://avatars.githubusercontent.com/u/47144?v=2","gravatar_id":"ca214b27a92214d5682aabf09cac4391","url":"https://api.github.com/users/aron","html_url":"https://github.com/aron","followers_url":"https://api.github.com/users/aron/followers","following_url":"https://api.github.com/users/aron/following{/other_user}","gists_url":"https://api.github.com/users/aron/gists{/gist_id}","starred_url":"https://api.github.com/users/aron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aron/subscriptions","organizations_url":"https://api.github.com/users/aron/orgs","repos_url":"https://api.github.com/users/aron/repos","events_url":"https://api.github.com/users/aron/events{/privacy}","received_events_url":"https://api.github.com/users/aron/received_events","type":"User","site_admin":false},"body":"We should display an error message but not disable the button when clicking the button.","created_at":"2014-09-12T09:20:27Z","updated_at":"2014-09-12T09:20:27Z","html_url":"https://github.com/hypothesis/h/pull/1436#discussion_r17470050","pull_request_url":"https://api.github.com/repos/hypothesis/h/pulls/1436","_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments/17470050"},"html":{"href":"https://github.com/hypothesis/h/pull/1436#discussion_r17470050"},"pull_request":{"href":"https://api.github.com/repos/hypothesis/h/pulls/1436"}}},"pull_request":{"url":"https://api.github.com/repos/hypothesis/h/pulls/1436","id":20204390,"html_url":"https://github.com/hypothesis/h/pull/1436","diff_url":"https://github.com/hypothesis/h/pull/1436.diff","patch_url":"https://github.com/hypothesis/h/pull/1436.patch","issue_url":"https://api.github.com/repos/hypothesis/h/issues/1436","number":1436,"state":"open","locked":false,"title":"WIP Overhaul view and sort behavior","user":{"login":"tilgovi","id":20818,"avatar_url":"https://avatars.githubusercontent.com/u/20818?v=2","gravatar_id":"097005ba3431bda404fcc27976aa3150","url":"https://api.github.com/users/tilgovi","html_url":"https://github.com/tilgovi","followers_url":"https://api.github.com/users/tilgovi/followers","following_url":"https://api.github.com/users/tilgovi/following{/other_user}","gists_url":"https://api.github.com/users/tilgovi/gists{/gist_id}","starred_url":"https://api.github.com/users/tilgovi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tilgovi/subscriptions","organizations_url":"https://api.github.com/users/tilgovi/orgs","repos_url":"https://api.github.com/users/tilgovi/repos","events_url":"https://api.github.com/users/tilgovi/events{/privacy}","received_events_url":"https://api.github.com/users/tilgovi/received_events","type":"User","site_admin":false},"body":"Big changes to view, sort, routing, filtering, etc, etc, etc...\r\n\r\nTodo\r\n-------\r\n- [x] stream search -- race between $scope.updater and stream controller, need to send the filter\r\n- [x] page search -- simple matter of fixing the ugly ng-show conditions at the bottom of the viewer template perhaps with more verbose, obvious variables, or scope/controller functions to abstract the route details from the template a bit\r\n- [x] Check on https://github.com/hypothesis/h/pull/1436#discussion_r16705832 (leave as is 2014-08-29)\r\n- [x] Restore \"no results for “query”\" message.\r\n- [x] Annotations don't watch for changes\r\n- [ ] forced login -- a comment about ideas for that [here](https://github.com/hypothesis/h/issues/1020#issuecomment-53400218)\r\n- [ ] Card emphasis on highlight hover\r\n- [ ] Redaction\r\n","created_at":"2014-08-23T00:44:11Z","updated_at":"2014-09-12T09:20:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47d16d0ea1afc26c13174a32e31ab58a82f3f203","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hypothesis/h/pulls/1436/commits","review_comments_url":"https://api.github.com/repos/hypothesis/h/pulls/1436/comments","review_comment_url":"https://api.github.com/repos/hypothesis/h/pulls/comments/{number}","comments_url":"https://api.github.com/repos/hypothesis/h/issues/1436/comments","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/765023f9f929562c4920d4fdc7467320a709185a","head":{"label":"hypothesis:view-sort-overhaul","ref":"view-sort-overhaul","sha":"765023f9f929562c4920d4fdc7467320a709185a","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=2","gravatar_id":"95447824e3f558893f0fda4402920cba","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=2","gravatar_id":"95447824e3f558893f0fda4402920cba","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments/{number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2014-09-11T03:35:05Z","pushed_at":"2014-09-12T03:18:23Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":46520,"stargazers_count":321,"watchers_count":321,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":87,"mirror_url":null,"open_issues_count":182,"forks":87,"open_issues":182,"watchers":321,"default_branch":"master"}},"base":{"label":"hypothesis:master","ref":"master","sha":"3fe2a1b4e289b22713d046ac8c780d5239d41e26","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=2","gravatar_id":"95447824e3f558893f0fda4402920cba","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=2","gravatar_id":"95447824e3f558893f0fda4402920cba","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments/{number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2014-09-11T03:35:05Z","pushed_at":"2014-09-12T03:18:23Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":46520,"stargazers_count":321,"watchers_count":321,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":87,"mirror_url":null,"open_issues_count":182,"forks":87,"open_issues":182,"watchers":321,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/1436"},"html":{"href":"https://github.com/hypothesis/h/pull/1436"},"issue":{"href":"https://api.github.com/repos/hypothesis/h/issues/1436"},"comments":{"href":"https://api.github.com/repos/hypothesis/h/issues/1436/comments"},"review_comments":{"href":"https://api.github.com/repos/hypothesis/h/pulls/1436/comments"},"review_comment":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/hypothesis/h/pulls/1436/commits"},"statuses":{"href":"https://api.github.com/repos/hypothesis/h/statuses/765023f9f929562c4920d4fdc7467320a709185a"}}}}