Commit 35e5b954 authored by Dima Gerasimov's avatar Dima Gerasimov Committed by Hannah Stepanek

Open sidebar when highlighting while logged-out

When the user creates a highlight while logged out, they appear to
work however, they silently do not get saved. An error message
does pop up in the sidebar informing them they cannot create annotations
when not logged in but they don't see it because the sidebar does not
open when creating a highlight. This makes the error message more
apparent to the user by popping open the sidebar.
parent 3bc44117
......@@ -53,6 +53,7 @@ function AnnotationController(
store,
annotationMapper,
api,
bridge,
drafts,
flash,
groups,
......@@ -197,6 +198,11 @@ function AnnotationController(
return;
}
if (!self.annotation.user) {
// Open sidebar to display error message about needing to login to create highlights.
bridge.call('showSidebar');
}
if (!self.isHighlight()) {
// Not a highlight,
return;
......
......@@ -115,6 +115,7 @@ describe('annotation', function() {
let fakeSession;
let fakeSettings;
let fakeApi;
let fakeBridge;
let fakeStreamer;
let sandbox;
......@@ -248,6 +249,10 @@ describe('annotation', function() {
},
};
fakeBridge = {
call: sinon.stub(),
};
fakeStreamer = {
hasPendingDeletion: sinon.stub(),
};
......@@ -256,6 +261,7 @@ describe('annotation', function() {
$provide.value('annotationMapper', fakeAnnotationMapper);
$provide.value('store', fakeStore);
$provide.value('api', fakeApi);
$provide.value('bridge', fakeBridge);
$provide.value('drafts', fakeDrafts);
$provide.value('flash', fakeFlash);
$provide.value('groups', fakeGroups);
......
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