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
Hide 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');
* @param settings - Application settings
*/
// @ngInject
function
Streamer
(
$rootScope
,
annotationMapper
,
annotationUI
,
features
,
groups
,
se
ssion
,
se
ttings
)
{
function
Streamer
(
$rootScope
,
annotationMapper
,
annotationUI
,
groups
,
session
,
settings
)
{
// The randomly generated session UUID
var
clientId
=
uuid
.
v4
();
...
...
@@ -84,8 +84,7 @@ function Streamer($rootScope, annotationMapper, annotationUI, features, groups,
break
;
}
if
(
!
features
.
flagEnabled
(
'defer_realtime_updates'
)
||
!
annotationUI
.
isSidebar
())
{
if
(
!
annotationUI
.
isSidebar
())
{
applyPendingUpdates
();
}
}
...
...
h/static/scripts/test/streamer-test.js
View file @
3b154a4b
...
...
@@ -67,7 +67,6 @@ inherits(FakeSocket, EventEmitter);
describe
(
'Streamer'
,
function
()
{
var
fakeAnnotationMapper
;
var
fakeAnnotationUI
;
var
fakeFeatures
;
var
fakeGroups
;
var
fakeRootScope
;
var
fakeSession
;
...
...
@@ -80,7 +79,6 @@ describe('Streamer', function () {
fakeRootScope
,
fakeAnnotationMapper
,
fakeAnnotationUI
,
fakeFeatures
,
fakeGroups
,
fakeSession
,
fakeSettings
...
...
@@ -110,10 +108,6 @@ describe('Streamer', function () {
isSidebar
:
sinon
.
stub
().
returns
(
true
),
};
fakeFeatures
=
{
flagEnabled
:
sinon
.
stub
().
returns
(
false
),
};
fakeGroups
=
{
focused
:
sinon
.
stub
().
returns
({
id
:
'public'
}),
};
...
...
@@ -194,29 +188,8 @@ describe('Streamer', function () {
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
()
{
beforeEach
(
function
()
{
// Enable the `defer_realtime_updates` feature flag
fakeFeatures
.
flagEnabled
.
returns
(
true
);
fakeAnnotationUI
.
isSidebar
.
returns
(
false
);
});
...
...
@@ -237,11 +210,7 @@ describe('Streamer', function () {
});
});
context
(
'when realtime updates are deferred'
,
function
()
{
beforeEach
(
function
()
{
fakeFeatures
.
flagEnabled
.
returns
(
true
);
});
context
(
'when the app is the sidebar'
,
function
()
{
it
(
'saves pending updates'
,
function
()
{
fakeWebSocket
.
notify
(
fixtures
.
createNotification
);
assert
.
equal
(
activeStreamer
.
countPendingUpdates
(),
1
);
...
...
@@ -303,7 +272,6 @@ describe('Streamer', function () {
beforeEach
(
function
()
{
createDefaultStreamer
();
activeStreamer
.
connect
();
fakeFeatures
.
flagEnabled
.
returns
(
true
);
});
it
(
'applies pending updates'
,
function
()
{
...
...
@@ -340,7 +308,6 @@ describe('Streamer', function () {
beforeEach
(
function
()
{
createDefaultStreamer
();
activeStreamer
.
connect
();
fakeFeatures
.
flagEnabled
.
returns
(
true
);
});
unroll
(
'discards pending updates when #event occurs'
,
function
(
testCase
)
{
...
...
@@ -364,7 +331,6 @@ describe('Streamer', function () {
it
(
'clears pending updates and deletions'
,
function
()
{
createDefaultStreamer
();
activeStreamer
.
connect
();
fakeFeatures
.
flagEnabled
.
returns
(
true
);
fakeWebSocket
.
notify
(
fixtures
.
createNotification
);
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