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