1. 15 May, 2017 1 commit
  2. 12 May, 2017 4 commits
  3. 09 May, 2017 4 commits
  4. 04 May, 2017 2 commits
  5. 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
  6. 24 Apr, 2017 11 commits
  7. 21 Apr, 2017 2 commits
  8. 20 Apr, 2017 6 commits
  9. 19 Apr, 2017 5 commits
  10. 18 Apr, 2017 3 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