Commit a25b7679 authored by Robert Knight's avatar Robert Knight

Rename "groups" => "groupsService" where possible

The name of the "groups" service is slightly ambiguous in this context.
We can't rename the prop because service dependencies are resolved by
name and the service is called "groups" when registered with Angular.
parent f37dbb5b
......@@ -16,7 +16,7 @@ const MenuItem = require('./menu-item');
* The item has a primary action which selects the group, along with a set of
* secondary actions accessible via a toggle menu.
*/
function GroupListItem({ analytics, group, groups }) {
function GroupListItem({ analytics, group, groups: groupsService }) {
const canLeaveGroup = group.type === 'private';
const activityUrl = group.links.html;
const hasActionMenu = activityUrl || canLeaveGroup;
......@@ -43,7 +43,7 @@ function GroupListItem({ analytics, group, groups }) {
const message = `Are you sure you want to leave the group "${group.name}"?`;
if (window.confirm(message)) {
analytics.track(analytics.events.GROUP_LEAVE);
groups.leave(group.id);
groupsService.leave(group.id);
}
};
......@@ -111,6 +111,7 @@ function GroupListItem({ analytics, group, groups }) {
GroupListItem.propTypes = {
group: propTypes.object.isRequired,
// Injected services.
analytics: propTypes.object.isRequired,
groups: propTypes.object.isRequired,
};
......
......@@ -9,7 +9,7 @@ const { events } = require('../../services/analytics');
describe('GroupListItem', () => {
let fakeAnalytics;
let fakeGroups;
let fakeGroupsService;
let fakeStore;
let fakeGroupListItemCommon;
......@@ -41,7 +41,7 @@ describe('GroupListItem', () => {
orgName: sinon.stub(),
};
fakeGroups = {
fakeGroupsService = {
leave: sinon.stub(),
};
......@@ -59,7 +59,7 @@ describe('GroupListItem', () => {
return mount(
<GroupListItem
group={fakeGroup}
groups={fakeGroups}
groups={fakeGroupsService}
analytics={fakeAnalytics}
/>
);
......
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