1. 14 Dec, 2015 2 commits
    • Sean Hammond's avatar
      Remove some code duplication · 47d9024d
      Sean Hammond authored
      Clarify the pattern of using the presence or not of model.id to test
      whether an annotation is new in AnnotationController.
      47d9024d
    • Sean Hammond's avatar
      Don't change model.group on group change · 2f5b8bc1
      Sean Hammond authored
      Don't change model.group in AnnotationController when the currently focused
      group changes.
      
      model is supposed to be a read-only domain model, change vm.annotation instead.
      
      Changes to vm.annotation are copied over to model before saving model to the
      server.
      
      To make this work vm.group() should return the current group of the annotation,
      accounting for any changes made to vm.annotation but not saved to model or to
      the server yet. It should return vm.annotation.group not model.group.
      
      Similarly vm.isShared() should be based on vm.annotation not on model.
      
      Also remove some code in thread.coffee that was deliberately hiding new
      annotations that don't belong to the focused group (see commit
      272b2432c48a2d6bf890daa863e92f3a678b27b5). This is no longer the desired
      behaviour - when changing groups any new annotations move to the new group with
      us (and the GROUP_FOCUSED listener in AnnotationController will update
      vm.annotation.group to match).
      2f5b8bc1
  2. 11 Dec, 2015 28 commits
  3. 10 Dec, 2015 8 commits
    • Sean Hammond's avatar
      Merge pull request #2784 from hypothesis/consolidate-validation · 8ca3615f
      Sean Hammond authored
      Consolidate API validation
      8ca3615f
    • Sean Hammond's avatar
      Merge pull request #2790 from hypothesis/consolidate-templates · 052e930c
      Sean Hammond authored
      Move all templates into `templates/` directory
      052e930c
    • Nick Stenning's avatar
      Move all templates into `templates/` directory · 6ce010ad
      Nick Stenning authored
      It would be nice if each module could be responsible for their own
      templates, but in reality nearly every template forms part of a large
      tree of templates, extending base layouts, and so on.
      
      In the interests of consistency, it makes sense to have all templates in
      the `h/templates/` directory rather than some being in `h/templates/`
      and some being in their respective module directories.
      6ce010ad
    • Sean Hammond's avatar
      Merge pull request #2791 from hypothesis/dont-explode-on-invalid-json · a06be299
      Sean Hammond authored
      Don't 500 when non-object JSON is POSTed to API create
      a06be299
    • Sean Hammond's avatar
      Merge pull request #2787 from hypothesis/fix-realtime-for-replies-standalone · a2d81275
      Sean Hammond authored
      Fix standalone annotation page realtime updates for replies to replies
      a2d81275
    • Sean Hammond's avatar
      Merge pull request #2786 from hypothesis/fix-standalone-reply-pages · 2cae4fe8
      Sean Hammond authored
      Fix standalone reply pages
      2cae4fe8
    • Nick Stenning's avatar
      Fix standalone annotation page realtime updates for replies to replies · ce6d5113
      Nick Stenning authored
      This commit fixes a bug where a standalone annotation page only receives
      realtime updates for replies on that page if the top-level annotation on
      the page is also the root of its message thread.
      
      The annotation `references` field contains the ids of all ancestors in
      the message thread, from oldest to newest -- that is, the earlier in the
      references field an id appears, the higher it is in the message tree.
      
      In order to receive realtime updates for all messages in the part of the
      thread displayed on a standalone annotation page, we need to ask for:
      
      - all updates in which the id in the URL matches the id in the
        annotation (i.e. updates to the top-most displayed annotation, which
        may itself be a reply).
      
      - all updates in which the id in the URL *is contained in* the
        `references` field of an annotation (i.e. updates for any annotation
        lower in the message thread)
      
      Previously, this code requested all updates in which the id *was the
      first entry* in the references field, which is only ever true for the
      root of a message thread, meaning that it only ever worked on standalone
      annotation pages for top-level annotations, and not on pages for
      replies.
      ce6d5113
    • Nick Stenning's avatar
      Fix standalone reply pages · fe0250ca
      Nick Stenning authored
      This commit is a partial revert of 4628b26, affecting standalone
      annotation pages only.
      
      That commit changed the AnnotationViewerController (the component
      responsible for standalone annotation pages) to make a single request to
      the search API to load an annotation and all its replies, rather than
      two requests -- for the annotation and then for its replies.
      
      This works just fine so long as the top-level annotation is not itself a
      reply. In that case, however, the search endpoint returns nothing, as
      the (temporary) `_separate_replies` parameter ensures that only
      top-level annotations are matched.
      
      This commit switches back to making two requests to populate the
      client-side data structures for the standalone annotation page:
      
      1. To fetch the annotation referenced in the URL (which may itself be a
         reply).
      2. To fetch any replies to the annotation referenced in the URL.
      
      Fixes #2775.
      fe0250ca
  4. 07 Dec, 2015 2 commits