Commit 3b154a4b authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #173 from hypothesis/remove-defer-realtime-updates-flag

Remove 'defer_realtime_updates' feature flagging
parents ff8e000e fad29df7
...@@ -19,8 +19,8 @@ var Socket = require('./websocket'); ...@@ -19,8 +19,8 @@ var Socket = require('./websocket');
* @param settings - Application settings * @param settings - Application settings
*/ */
// @ngInject // @ngInject
function Streamer($rootScope, annotationMapper, annotationUI, features, groups, function Streamer($rootScope, annotationMapper, annotationUI, groups, session,
session, settings) { settings) {
// The randomly generated session UUID // The randomly generated session UUID
var clientId = uuid.v4(); var clientId = uuid.v4();
...@@ -84,8 +84,7 @@ function Streamer($rootScope, annotationMapper, annotationUI, features, groups, ...@@ -84,8 +84,7 @@ function Streamer($rootScope, annotationMapper, annotationUI, features, groups,
break; break;
} }
if (!features.flagEnabled('defer_realtime_updates') || if (!annotationUI.isSidebar()) {
!annotationUI.isSidebar()) {
applyPendingUpdates(); applyPendingUpdates();
} }
} }
......
...@@ -67,7 +67,6 @@ inherits(FakeSocket, EventEmitter); ...@@ -67,7 +67,6 @@ inherits(FakeSocket, EventEmitter);
describe('Streamer', function () { describe('Streamer', function () {
var fakeAnnotationMapper; var fakeAnnotationMapper;
var fakeAnnotationUI; var fakeAnnotationUI;
var fakeFeatures;
var fakeGroups; var fakeGroups;
var fakeRootScope; var fakeRootScope;
var fakeSession; var fakeSession;
...@@ -80,7 +79,6 @@ describe('Streamer', function () { ...@@ -80,7 +79,6 @@ describe('Streamer', function () {
fakeRootScope, fakeRootScope,
fakeAnnotationMapper, fakeAnnotationMapper,
fakeAnnotationUI, fakeAnnotationUI,
fakeFeatures,
fakeGroups, fakeGroups,
fakeSession, fakeSession,
fakeSettings fakeSettings
...@@ -110,10 +108,6 @@ describe('Streamer', function () { ...@@ -110,10 +108,6 @@ describe('Streamer', function () {
isSidebar: sinon.stub().returns(true), isSidebar: sinon.stub().returns(true),
}; };
fakeFeatures = {
flagEnabled: sinon.stub().returns(false),
};
fakeGroups = { fakeGroups = {
focused: sinon.stub().returns({id: 'public'}), focused: sinon.stub().returns({id: 'public'}),
}; };
...@@ -194,29 +188,8 @@ describe('Streamer', function () { ...@@ -194,29 +188,8 @@ describe('Streamer', function () {
activeStreamer.connect(); activeStreamer.connect();
}); });
context('when realtime updates are not deferred', function () {
it('should load new annotations', function () {
fakeWebSocket.notify(fixtures.createNotification);
assert.ok(fakeAnnotationMapper.loadAnnotations.calledOnce);
});
it('should unload deleted annotations', function () {
fakeAnnotationUI.annotationExists.returns(true);
fakeWebSocket.notify(fixtures.deleteNotification);
assert.ok(fakeAnnotationMapper.unloadAnnotations.calledOnce);
});
it('ignores notifications about annotations in unfocused groups', function () {
fakeGroups.focused.returns({id: 'private'});
fakeWebSocket.notify(fixtures.createNotification);
assert.notCalled(fakeAnnotationMapper.loadAnnotations);
});
});
context('when the app is the stream', function () { context('when the app is the stream', function () {
beforeEach(function () { beforeEach(function () {
// Enable the `defer_realtime_updates` feature flag
fakeFeatures.flagEnabled.returns(true);
fakeAnnotationUI.isSidebar.returns(false); fakeAnnotationUI.isSidebar.returns(false);
}); });
...@@ -237,11 +210,7 @@ describe('Streamer', function () { ...@@ -237,11 +210,7 @@ describe('Streamer', function () {
}); });
}); });
context('when realtime updates are deferred', function () { context('when the app is the sidebar', function () {
beforeEach(function () {
fakeFeatures.flagEnabled.returns(true);
});
it('saves pending updates', function () { it('saves pending updates', function () {
fakeWebSocket.notify(fixtures.createNotification); fakeWebSocket.notify(fixtures.createNotification);
assert.equal(activeStreamer.countPendingUpdates(), 1); assert.equal(activeStreamer.countPendingUpdates(), 1);
...@@ -303,7 +272,6 @@ describe('Streamer', function () { ...@@ -303,7 +272,6 @@ describe('Streamer', function () {
beforeEach(function () { beforeEach(function () {
createDefaultStreamer(); createDefaultStreamer();
activeStreamer.connect(); activeStreamer.connect();
fakeFeatures.flagEnabled.returns(true);
}); });
it('applies pending updates', function () { it('applies pending updates', function () {
...@@ -340,7 +308,6 @@ describe('Streamer', function () { ...@@ -340,7 +308,6 @@ describe('Streamer', function () {
beforeEach(function () { beforeEach(function () {
createDefaultStreamer(); createDefaultStreamer();
activeStreamer.connect(); activeStreamer.connect();
fakeFeatures.flagEnabled.returns(true);
}); });
unroll('discards pending updates when #event occurs', function (testCase) { unroll('discards pending updates when #event occurs', function (testCase) {
...@@ -364,7 +331,6 @@ describe('Streamer', function () { ...@@ -364,7 +331,6 @@ describe('Streamer', function () {
it('clears pending updates and deletions', function () { it('clears pending updates and deletions', function () {
createDefaultStreamer(); createDefaultStreamer();
activeStreamer.connect(); activeStreamer.connect();
fakeFeatures.flagEnabled.returns(true);
fakeWebSocket.notify(fixtures.createNotification); fakeWebSocket.notify(fixtures.createNotification);
fakeRootScope.$broadcast(events.GROUP_FOCUSED); fakeRootScope.$broadcast(events.GROUP_FOCUSED);
......
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