Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
3b154a4b
Commit
3b154a4b
authored
Nov 30, 2016
by
Robert Knight
Committed by
GitHub
Nov 30, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #173 from hypothesis/remove-defer-realtime-updates-flag
Remove 'defer_realtime_updates' feature flagging
parents
ff8e000e
fad29df7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
39 deletions
+4
-39
streamer.js
h/static/scripts/streamer.js
+3
-4
streamer-test.js
h/static/scripts/test/streamer-test.js
+1
-35
No files found.
h/static/scripts/streamer.js
View file @
3b154a4b
...
@@ -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
,
se
ssion
,
se
ttings
)
{
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
();
}
}
}
}
...
...
h/static/scripts/test/streamer-test.js
View file @
3b154a4b
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment