1. 09 May, 2017 2 commits
  2. 04 May, 2017 2 commits
  3. 27 Apr, 2017 2 commits
    • Sean Hammond's avatar
      f2f5775f
    • Sean Hammond's avatar
      Improve error when flagging when logged out · cd22ae61
      Sean Hammond authored
      Improve the error message that's shown to the user when trying to flag
      an annotation while logged out.
      
      Instead of showing a "404 Not Found. Either the resource you requested
      doesn't exist, or you are not currently authorized to see it." error
      from the server, show a friendlier "You must be logged in to report an
      annotation" message.
      
      This is done client-side by checking whether the user is logged in when
      they click the flag button, and if not showing an error instead of
      sending the flag request to the API. This is because the API doesn't
      respond with a unique "You must be logged in to flag" error that the
      client could depend on, it just returns a 404, which could be for a
      number of reasons (e.g. the annotation no longer exists).
      cd22ae61
  4. 24 Apr, 2017 11 commits
  5. 21 Apr, 2017 2 commits
  6. 20 Apr, 2017 6 commits
  7. 19 Apr, 2017 5 commits
  8. 18 Apr, 2017 8 commits
    • Robert Knight's avatar
      Merge pull request #356 from hypothesis/use-new-links-api · d49669b3
      Robert Knight authored
      Use the new `/api/links` resource
      d49669b3
    • Sean Hammond's avatar
      Log a warning if the links API request is rejected · b40af32e
      Sean Hammond authored
      There's no unit test for this. Because of Promises, it cannot be tested
      without refactoring serviceUrl.
      b40af32e
    • Sean Hammond's avatar
      Change serviceUrl to use the /api/links · ea9069a7
      Sean Hammond authored
      Change serviceUrl to return URLs by expanding URL templates received
      from h's /api/links resource, rather than using hardcoded URL templates
      as it previously did.
      
      The interface and contract that serviceUrl presents to its users remains
      the same - the fact it's now sending an API request to get the URL
      templates, and waiting for the response, is completely hidden from its
      users.
      
      This hiding is achieved by two tricks:
      
      1. Always returning "" for an expanded URL if the API response hasn't
         been received yet, rather than, for example, changing the interface
         to return Promises instead of strings (which would then require
         changes to every user of the interface, and possibly their users...)
      
      2. Updating annotationUI, the Redux state store, with the new URL
         templates when the API response is received. This causes any
         AngularJS components that might have used an (empty string) URL to be
         re-rendered, they will call sericeUrl URL again and this time get the
         actual URLs.
      
         This is completely transparent to the components - annotationUI
         causes AngularJS to call them again and this time they will get a
         different result from serviceUrl. The code of the components
         themselves doesn't need to change.
      
      Additionally, serviceUrl will never throw errors if it hasn't received
      the API response yet. For example there is no error if an unknown link
      name is requested, or if unused template params are given. It just
      always returns "". Once it _does_ have the API response then it will
      start throwing errors for bad requests, the same as it did previously.
      ea9069a7
    • Sean Hammond's avatar
      Add store.links() API wrapper · 50aeb3b5
      Sean Hammond authored
      Add a new function to `store`, the https://hypothes.is/api wrapper,
      that provides access to the new https://hypothes.is/api/links resource.
      50aeb3b5
    • Sean Hammond's avatar
      Add links reducer · ad8cbf1c
      Sean Hammond authored
      Add a Redux reducer for storing the links (URL templates) from the
      /api/links HTTP resource in the state store.
      ad8cbf1c
    • Robert Knight's avatar
      Add test to verify that link field is focused and selected when dialog opens · 29ded206
      Robert Knight authored
      This adds a missing test for the behavior and also fixes variance in
      test coverage between runs because the code that implements this
      behavior sometimes ran and sometimes did not.
      29ded206
    • Robert Knight's avatar
      Use a transparent backdrop to intercept clicks outside share dialog · b376de32
      Robert Knight authored
      Instead of adding event listeners to the document to track clicks
      outside the share dialog, use a transparent backdrop element behind the
      share dialog which covers the whole page.
      
      This avoids the need to register/unregister document-level event
      handlers in the controller, removing some code which was untested.
      b376de32
    • Robert Knight's avatar
      Consistency improvements for `<annotation-share-dialog>` · 56f5043f
      Robert Knight authored
      Refactor the annotation share dialog's controller for consistency with
      other components:
      
       - Move controller to a top-level function in the file
      
       - Capture `this` as `self` rather than using `bind`
      
       - Attach `onShareClick` to controller rather than `$scope`
      56f5043f
  9. 13 Apr, 2017 2 commits
    • Robert Knight's avatar
      b2fbc8c7
    • Robert Knight's avatar
      Rewrite the permissions service · 31bffa4e
      Robert Knight authored
      This commit replaces the 'permissions' service with a minimal
      implementation which supports only what is required by the
      actual permissions model in the client and service, rather than
      all the possible permissions implied by the structure of the
      `permissions` field.
      
      In the client and service, annotations are simply "shared" or "private":
      
       "private" annotations can be read, updated and deleted only by
       their creator.
      
       "shared" annotations can additionally be read by everyone in the group
       that the annotation is associated with.
      31bffa4e