Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Fix link interpolation in invite fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
el-mapache committed Jul 25, 2017
1 parent 1469376 commit f1b53d0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
14 changes: 7 additions & 7 deletions static_src/components/users.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const ORG_MANAGER = 'org_manager';
const SPACE_MANAGER = 'space_manager';
const ORG_ENTITY = 'organization';
const SPACE_ENTITY = 'space';
const cfCliLink = 'https://docs.cloudfoundry.org/adminguide/cli-user-management.html#space-roles';

function stateSetter() {
const currentOrgGuid = OrgStore.currentOrgGuid;
Expand Down Expand Up @@ -163,15 +164,14 @@ export default class Users extends React.Component {

get userInvite() {
if (!this.currentUserIsOrgManager) {
const cfAPILink = 'https://cloud.gov/docs/getting-started/setup/#set-up-the-command-line';

return (
<PanelDocumentation>
{`Currently, only an org manager can invite users to this ${this.entityType}
via the dashboard. If the user you want to add is already a cloud.gov member,
you can invite them using the <a href=${cfAPILink}>cloud foundry api. </a>
Speak to your org manager if you need to add a user to this ${this.entityType} who
is not a member of cloud.gov`}
Currently, only an org manager can invite users to this { this.entityType } via
the dashboard. If the user you want to add is already a member
of this organization, you can invite them using the
<a href={ cfCliLink }> cloud foundry command line interface. </a>
Speak to your org manager if you need to add a user to this { this.entityType } who
is not a member of this organization.
</PanelDocumentation>
);
}
Expand Down
20 changes: 16 additions & 4 deletions static_src/test/unit/components/users.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,29 @@ describe('<Users />', () => {
});

describe('when a user is not an org manager', () => {
it('renders message telling user to ask an org manager to add users', () => {
const spaceUser = Object.assign({}, user, {
roles: buildRoles(spaceGuid, ['space_manager'])
});
const spaceUser = Object.assign({}, user, {
roles: buildRoles(spaceGuid, ['space_manager'])
});

beforeEach(() => {
UserStore._data = Immutable.fromJS([spaceUser]);
users = shallow(<Users />);
});

it('renders message telling user to ask an org manager to add users', () => {
expect(users.find(UsersInvite).length).toBe(0);
expect(users.find(PanelDocumentation).length).toBe(1);
});

it('renders a link for the user to follow to get more information', () => {
const panelDoc = users.find(PanelDocumentation);
const link = panelDoc.find('a');
// eslint-disable-next-line max-len
const href = 'https://docs.cloudfoundry.org/adminguide/cli-user-management.html#space-roles';

expect(link.length).toBe(1);
expect(link.prop('href')).toBe(href);
});
});
});
});

0 comments on commit f1b53d0

Please sign in to comment.