Commit 206278e6 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #3529 from...

Merge pull request #3529 from hypothesis/3167-do-not-show-you-do-not-have-permission-card-while-waiting-for-document-to-load

Don't show permissions error before annotation
parents 711c6eeb a698d261
......@@ -344,6 +344,17 @@ describe('WidgetController', function () {
});
describe('direct linking messages', function () {
beforeEach(function () {
// The document has finished loading.
fakeCrossFrame.frames = [
{
uri: 'http://www.example.com',
searchUris: [],
}
];
});
it('displays a message if the selection is unavailable', function () {
annotationUI.selectAnnotations(['missing']);
$scope.$digest();
......@@ -363,6 +374,18 @@ describe('WidgetController', function () {
assert.isFalse($scope.selectedAnnotationUnavailable());
});
it("doesn't show a message if the document isn't loaded yet", function () {
// No search requests have been sent yet.
searchClients = [];
// There is a selection but the selected annotation isn't available.
annotationUI.selectAnnotations(['missing']);
// The document hasn't finished loading.
fakeCrossFrame.frames = [];
$scope.$digest();
assert.isFalse($scope.selectedAnnotationUnavailable());
});
it('shows logged out message if selection is available', function () {
$scope.auth = {
status: 'signed-out'
......
......@@ -181,7 +181,17 @@ module.exports = function WidgetController(
}
function isLoading() {
return searchClients.length > 0;
if (!crossframe.frames.some(function (frame) { return frame.uri; })) {
// The document's URL isn't known so the document must still be loading.
return true;
}
if (searchClients.length > 0) {
// We're still waiting for annotation search results from the API.
return true;
}
return false;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment