Commit 7374f07a authored by Robert Knight's avatar Robert Knight

Remove unused `GROUPS_CHANGED` event listener in groups service

This event is never broadcast anywhere. A comment referenced this being
called when a user leaves a group, but this is handled in the `streamer`
service by calling `groups.load()` directly.
parent e717fa8e
...@@ -11,8 +11,6 @@ module.exports = { ...@@ -11,8 +11,6 @@ module.exports = {
// Session state changes // Session state changes
/** The list of groups changed */
GROUPS_CHANGED: 'groupsChanged',
/** The logged-in user changed */ /** The logged-in user changed */
USER_CHANGED: 'userChanged', USER_CHANGED: 'userChanged',
/** /**
......
...@@ -130,12 +130,6 @@ function groups($rootScope, store, api, isSidebar, localStorage, serviceUrl, ses ...@@ -130,12 +130,6 @@ function groups($rootScope, store, api, isSidebar, localStorage, serviceUrl, ses
} }
}); });
// reset the focused group if the user leaves it
$rootScope.$on(events.GROUPS_CHANGED, function () {
// return for use in test
return load();
});
// refetch the list of groups when user changes // refetch the list of groups when user changes
$rootScope.$on(events.USER_CHANGED, () => { $rootScope.$on(events.USER_CHANGED, () => {
// FIXME Makes a second api call on page load. better way? // FIXME Makes a second api call on page load. better way?
......
...@@ -68,7 +68,7 @@ describe('groups', function() { ...@@ -68,7 +68,7 @@ describe('groups', function() {
}, },
$on: function(event, callback) { $on: function(event, callback) {
if (event === events.GROUPS_CHANGED || event === events.USER_CHANGED || event === events.FRAME_CONNECTED) { if (event === events.USER_CHANGED || event === events.FRAME_CONNECTED) {
this.eventCallbacks[event] = callback; this.eventCallbacks[event] = callback;
} }
}, },
...@@ -250,18 +250,13 @@ describe('groups', function() { ...@@ -250,18 +250,13 @@ describe('groups', function() {
}); });
describe('calls load on various events', function () { describe('calls load on various events', function () {
var changeEvents = [ it('refetches groups when the logged-in user changes', () => {
{event: events.GROUPS_CHANGED},
{event: events.USER_CHANGED},
];
unroll('should fetch the list of groups from the server when #event occurs', function (testCase) {
service(); service();
return fakeRootScope.eventCallbacks[testCase.event]().then(() => { return fakeRootScope.eventCallbacks[events.USER_CHANGED]().then(() => {
assert.calledOnce(fakeApi.groups.list); assert.calledOnce(fakeApi.groups.list);
}); });
}, changeEvents); });
context('when a new frame connects', () => { context('when a new frame connects', () => {
it('should refetch groups if main frame URL has changed', () => { it('should refetch groups if main frame URL has changed', () => {
......
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