1. 10 May, 2017 1 commit
    • Juan Corona's avatar
      Fix the scoping of the initial value for the `plugins` property · acddfb66
      Juan Corona authored
      This fixes the remaining failing tests.
      When compiled from coffeescript the initial `{}` value was at the prototype level instead of scoped at the function level.
      It looked like I was declaring it as an instance variable, but it was more like a class variable.. coffeescript is weird to me..
      acddfb66
  2. 09 May, 2017 4 commits
    • Juan Corona's avatar
      Fix linter error · 77271a90
      Juan Corona authored
      77271a90
    • Juan Corona's avatar
      Fix issues found after removing annotator.js · f29cd223
      Juan Corona authored
      Failing tests and what was fixed:
      1. Sidebar was not closing when the user taps or clicks in the page.
      	- Function that set up event handlers used to be called by the `Annotator` base class, now called directly in `Sidebar`
      2. Config params used in the passed options to the sidebar iframe leaked a new property (`pluginClasses`) used by the refactoring
      	- Filter that property in `Host`
      3. `Guest` was missing `deleteAnnotation` function implementation that used to be in `Annotator`
      
      Now only 2 tests should be failing
      f29cd223
    • Juan Corona's avatar
      Remove `Annotator` from the relevant tests · 376da9f8
      Juan Corona authored
      376da9f8
    • Juan Corona's avatar
      Remove the annotator.js vendor dependency · a5a8fdc0
      Juan Corona authored
      In order to avoid heavy refactoring some classes from Annotator were moved over to this codebase.
      This includes the class for the `Document` plugin and Annotator’s base class `Delegator`.
      
      The class `Guest` is now responsible for loading the remaining Annotator-style plugin modules.
      The base class for `Guest` is now `Delegator` instead of `Annotator`.
      a5a8fdc0
  3. 04 May, 2017 2 commits
  4. 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
  5. 24 Apr, 2017 11 commits
  6. 21 Apr, 2017 2 commits
  7. 20 Apr, 2017 6 commits
  8. 19 Apr, 2017 5 commits
  9. 18 Apr, 2017 7 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