• Sean Hammond's avatar
    Don't show permissions error before annotation · a698d261
    Sean Hammond authored
    Don't momentarily show a "You do not have permission to see this
    annotation" card before showing the annotation when loading a
    direct-linked annotation.
    
    Fixes #3167.
    
    When following direct links to annotations on certain documents,
    for example large PDF files that take a while to load,
    a "You do not have permission to see this annotation" card was being
    displayed briefly in place of the annotation card, before quickly being
    replaced by the correct annotation card.
    
    Previously the logic of the WidgetController.isLoading() function was to
    return true if we are currently waiting for the response to an
    annotation search request that we've sent.
    
    The theory is that this was happening:
    
    1. Client loads, but PDF has not yet loaded, so URL is unknown.
    
    2. Since the URL is unknown, the sidebar does not start fetching
       annotations and isLoading() returns false.
    
    3. Since the client a) Has a selection but b) Is not in a loading state
       - it thinks that it failed to fetch the annotation and displays the
       "You do not have permission to see this annotation" message,
    
    4. Once the PDF finishes loading, the URL is updated and that is
       reported to the sidebar which then performs a search query and
       isLoading() starts to return true until the search query response
       arrives then it returns false again.
    
    The fix is to make isLoading() return true if _either_ we've sent an
    annotation search request and are waiting on the response _or_ we're
    still waiting for the document to finish loading and haven't sent the
    search request yet. So instead of returning false, then true, then false
    again isLoading() will just keep returning true until both the document
    has loaded and the search response has been received, then it will start
    returning false.
    a698d261
Name
Last commit
Last update
..
annotator Loading commit data...
directive Loading commit data...
filter Loading commit data...
test Loading commit data...
util Loading commit data...
vendor Loading commit data...
admin-site.js Loading commit data...
admin-users.js Loading commit data...
annotation-mapper.js Loading commit data...
annotation-metadata.js Loading commit data...
annotation-sync.coffee Loading commit data...
annotation-ui-controller.js Loading commit data...
annotation-ui-sync.js Loading commit data...
annotation-ui.js Loading commit data...
annotation-viewer-controller.js Loading commit data...
app-controller.js Loading commit data...
app.js Loading commit data...
auth.js Loading commit data...
bridge.coffee Loading commit data...
build-thread.js Loading commit data...
create-group-form.js Loading commit data...
cross-frame.coffee Loading commit data...
date-util.js Loading commit data...
discovery.coffee Loading commit data...
drafts.js Loading commit data...
dropdown-menu.js Loading commit data...
events.js Loading commit data...
features.js Loading commit data...
flash.coffee Loading commit data...
form-respond.coffee Loading commit data...
form-select-onfocus-controller.js Loading commit data...
frame-rpc.js Loading commit data...
groups.js Loading commit data...
host.coffee Loading commit data...
installer-controller.js Loading commit data...
karma-phantomjs-polyfill.js Loading commit data...
karma.config.js Loading commit data...
legacy-site.js Loading commit data...
live-reload-client.js Loading commit data...
local-storage.coffee Loading commit data...
markdown-commands.js Loading commit data...
media-embedder.js Loading commit data...
page.js Loading commit data...
permissions.coffee Loading commit data...
polyfills.js Loading commit data...
query-parser.coffee Loading commit data...
raven.js Loading commit data...
render-markdown.js Loading commit data...
retry-util.js Loading commit data...
root-thread.js Loading commit data...
search-client.js Loading commit data...
search-filter.coffee Loading commit data...
session.js Loading commit data...
settings.js Loading commit data...
site.js Loading commit data...
store.js Loading commit data...
stream-controller.coffee Loading commit data...
stream-filter.coffee Loading commit data...
streamer.js Loading commit data...
tags.coffee Loading commit data...
time.js Loading commit data...
tsconfig.json Loading commit data...
ua-detect.js Loading commit data...
unicode.coffee Loading commit data...
view-filter.coffee Loading commit data...
virtual-thread-list.js Loading commit data...
websocket.js Loading commit data...
widget-controller.js Loading commit data...