Commit 8d1e11f4 authored by Hannah Stepanek's avatar Hannah Stepanek

Show error message when direct-link group error

parent 1940415e
......@@ -49,6 +49,8 @@ function SidebarContentController(
streamFilter
) {
const self = this;
this.directLinkedGroupFetchFailed =
!!settings.group && settings.group !== store.focusedGroup().id;
function thread() {
return rootThread.thread(store.getState());
......@@ -298,6 +300,9 @@ function SidebarContentController(
this.scrollTo = scrollToAnnotation;
this.selectedAnnotationCount = function() {
if (this.directLinkedGroupFetchFailed) {
return 1;
}
const selection = store.getState().selectedAnnotationMap;
if (!selection) {
return 0;
......@@ -305,6 +310,10 @@ function SidebarContentController(
return Object.keys(selection).length;
};
this.selectedGroupUnavailable = function() {
return !this.isLoading() && this.directLinkedGroupFetchFailed;
};
this.selectedAnnotationUnavailable = function() {
const selectedID = firstKey(store.getState().selectedAnnotationMap);
return (
......@@ -367,6 +376,8 @@ function SidebarContentController(
store.clearSelectedAnnotations();
store.selectTab(selectedTab);
// Clear direct-linked group fetch failed state.
this.directLinkedGroupFetchFailed = false;
};
}
......
......@@ -21,6 +21,7 @@
total-notes="vm.totalNotes">
</search-status-bar>
<!-- Display error message if direct-linked annotation fetch failed. -->
<sidebar-content-error
class="sidebar-content-error"
logged-out-error-message="'This annotation is not available.'"
......@@ -31,6 +32,17 @@
>
</sidebar-content-error>
<!-- Display error message if direct-linked group fetch failed. -->
<sidebar-content-error
class="sidebar-content-error"
logged-out-error-message="'This group is not available.'"
logged-in-error-message="'You either do not have permission to view this group, the group does not exist, or the group is not visible at this URL.'"
on-login-request="vm.onLogin()"
is-logged-in="vm.auth.status === 'logged-in'"
ng-if="vm.selectedGroupUnavailable()"
>
</sidebar-content-error>
<thread-list
on-change-collapsed="vm.setCollapsed(id, collapsed)"
on-clear-selection="vm.clearSelection()"
......@@ -38,6 +50,7 @@
on-force-visible="vm.forceVisible(thread)"
on-select="vm.scrollTo(annotation)"
show-document-info="false"
ng-if="!vm.selectedGroupUnavailable()"
thread="vm.rootThread">
</thread-list>
......
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