Commit a56c0ce0 authored by Hannah Stepanek's avatar Hannah Stepanek

Use same direct-linked group error when logged-in

parent 7cc4ad71
......@@ -6,6 +6,7 @@ const EventEmitter = require('tiny-emitter');
const events = require('../../events');
const sidebarContent = require('../sidebar-content');
const uiConstants = require('../../ui-constants');
const util = require('../../directive/test/util');
let searchClients;
......@@ -149,6 +150,19 @@ describe('sidebar.components.sidebar-content', function() {
});
}
function createSidebarContent(
{ userid } = { userid: 'acct:person@example.com' }
) {
return util.createDirective(document, 'sidebarContent', {
auth: {
status: userid ? 'logged-in' : 'logged-out',
userid: userid,
},
search: sinon.stub().returns({ query: sinon.stub() }),
onLogin: sinon.stub(),
});
}
const makeSidebarContentController = () => {
angular.mock.inject(function($componentController, _store_, _$rootScope_) {
$rootScope = _$rootScope_;
......@@ -337,6 +351,19 @@ describe('sidebar.components.sidebar-content', function() {
makeSidebarContentController();
});
[null, 'acct:person@example.com'].forEach(userid => {
it('displays same group error message regardless of login state', () => {
const element = createSidebarContent({ userid });
const sidebarContentError = element.find('.sidebar-content-error');
const errorMessage = sidebarContentError.attr(
'logged-in-error-message'
);
assert.equal(errorMessage, "'This group is not available.'");
});
});
it('sets directLinkedGroupFetchFailed to true', () => {
assert.isTrue(ctrl.directLinkedGroupFetchFailed);
});
......
......@@ -36,7 +36,7 @@
<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.'"
logged-in-error-message="'This group is not available.'"
on-login-request="vm.onLogin()"
is-logged-in="vm.auth.status === 'logged-in'"
ng-if="vm.selectedGroupUnavailable()"
......
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