Commit ca472783 authored by Sean Roberts's avatar Sean Roberts Committed by GitHub

Merge pull request #208 from hypothesis/remove-session-changed-event

Remove unused SESSION_CHANGED event
parents 454f05c4 9999efd6
......@@ -11,10 +11,6 @@ module.exports = {
GROUPS_CHANGED: 'groupsChanged',
/** The logged-in user changed */
USER_CHANGED: 'userChanged',
/**
* The session state was updated.
*/
SESSION_CHANGED: 'sessionChanged',
// UI state changes
......
......@@ -137,10 +137,6 @@ function session($http, $resource, $rootScope, annotationUI, auth,
lastLoad = Promise.resolve(model);
lastLoadTime = Date.now();
$rootScope.$broadcast(events.SESSION_CHANGED, {
initialLoad: isInitialLoad,
});
if (userChanged) {
auth.clearCache();
......
......@@ -227,33 +227,6 @@ describe('session', function () {
});
describe('#update()', function () {
it('broadcasts SESSION_CHANGED when the session changes', function () {
var sessionChangeCallback = sinon.stub();
// the initial load should trigger a SESSION_CHANGED event
// with initialLoad set
$rootScope.$on(events.SESSION_CHANGED, sessionChangeCallback);
session.update({
groups: [{
id: 'groupid',
}],
csrf: 'dummytoken',
});
assert.calledWith(sessionChangeCallback, sinon.match({}),
{initialLoad: true});
// subsequent loads should trigger a SESSION_CHANGED event
sessionChangeCallback.reset();
session.update({
groups: [{
id: 'groupid2',
}],
csrf: 'dummytoken',
});
assert.calledWith(sessionChangeCallback, sinon.match({}),
{initialLoad: false});
});
it('broadcasts GROUPS_CHANGED when the groups change', function () {
var groupChangeCallback = sinon.stub();
$rootScope.$on(events.GROUPS_CHANGED, groupChangeCallback);
......
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