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
db679988
Unverified
Commit
db679988
authored
Jan 14, 2020
by
Robert Knight
Committed by
GitHub
Jan 14, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1673 from hypothesis/convert-services-to-es-modules
Convert src/sidebar/services to ES modules
parents
248458e4
a165c422
Changes
43
Show whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
135 additions
and
166 deletions
+135
-166
analytics.js
src/sidebar/services/analytics.js
+2
-6
annotation-mapper.js
src/sidebar/services/annotation-mapper.js
+3
-5
annotations.js
src/sidebar/services/annotations.js
+8
-4
api-routes.js
src/sidebar/services/api-routes.js
+2
-4
api.js
src/sidebar/services/api.js
+4
-6
features.js
src/sidebar/services/features.js
+5
-6
flash.js
src/sidebar/services/flash.js
+1
-3
frame-sync.js
src/sidebar/services/frame-sync.js
+5
-5
groups.js
src/sidebar/services/groups.js
+5
-7
local-storage.js
src/sidebar/services/local-storage.js
+1
-3
oauth-auth.js
src/sidebar/services/oauth-auth.js
+4
-6
permissions.js
src/sidebar/services/permissions.js
+1
-3
root-thread.js
src/sidebar/services/root-thread.js
+11
-8
search-filter.js
src/sidebar/services/search-filter.js
+1
-3
service-url.js
src/sidebar/services/service-url.js
+2
-4
session.js
src/sidebar/services/session.js
+4
-6
stream-filter.js
src/sidebar/services/stream-filter.js
+1
-3
streamer.js
src/sidebar/services/streamer.js
+5
-8
tags.js
src/sidebar/services/tags.js
+1
-3
analytics-test.js
src/sidebar/services/test/analytics-test.js
+1
-1
annotation-mapper-test.js
src/sidebar/services/test/annotation-mapper-test.js
+5
-5
annotations-test.js
src/sidebar/services/test/annotations-test.js
+3
-3
api-routes-test.js
src/sidebar/services/test/api-routes-test.js
+1
-1
api-test.js
src/sidebar/services/test/api-test.js
+2
-2
features-test.js
src/sidebar/services/test/features-test.js
+4
-4
flash-test.js
src/sidebar/services/test/flash-test.js
+1
-1
frame-sync-test.js
src/sidebar/services/test/frame-sync-test.js
+8
-8
groups-test.js
src/sidebar/services/test/groups-test.js
+3
-3
local-storage-test.js
src/sidebar/services/test/local-storage-test.js
+3
-2
oauth-auth-test.js
src/sidebar/services/test/oauth-auth-test.js
+4
-5
permissions-test.js
src/sidebar/services/test/permissions-test.js
+1
-1
root-thread-test.js
src/sidebar/services/test/root-thread-test.js
+8
-8
search-filter-test.js
src/sidebar/services/test/search-filter-test.js
+1
-1
service-url-test.js
src/sidebar/services/test/service-url-test.js
+2
-2
session-test.js
src/sidebar/services/test/session-test.js
+5
-5
stream-filter-test.js
src/sidebar/services/test/stream-filter-test.js
+1
-1
streamer-test.js
src/sidebar/services/test/streamer-test.js
+3
-3
tags-test.js
src/sidebar/services/test/tags-test.js
+2
-2
unicode-test.js
src/sidebar/services/test/unicode-test.js
+1
-1
view-filter-test.js
src/sidebar/services/test/view-filter-test.js
+1
-1
unicode.js
src/sidebar/services/unicode.js
+1
-3
view-filter.js
src/sidebar/services/view-filter.js
+2
-4
threading-test.js
src/sidebar/test/integration/threading-test.js
+6
-6
No files found.
src/sidebar/services/analytics.js
View file @
db679988
const
VIA_REFERRER
=
/^https:
\/\/(
qa-
)?
via.hypothes.is
\/
/
;
const
events
=
{
export
const
events
=
{
ANNOTATION_CREATED
:
'annotationCreated'
,
ANNOTATION_DELETED
:
'annotationDeleted'
,
ANNOTATION_FLAGGED
:
'annotationFlagged'
,
...
...
@@ -70,7 +70,7 @@ function clientType(win, settings = {}) {
* application.
*/
// @ngInject
function
analytics
(
$window
,
settings
)
{
export
default
function
analytics
(
$window
,
settings
)
{
const
category
=
clientType
(
$window
,
settings
);
const
noop
=
()
=>
{};
...
...
@@ -117,7 +117,3 @@ function analytics($window, settings) {
events
,
};
}
analytics
.
events
=
events
;
module
.
exports
=
analytics
;
src/sidebar/services/annotation-mapper.js
View file @
db679988
const
angular
=
require
(
'angular'
)
;
import
angular
from
'angular'
;
const
events
=
require
(
'../events'
)
;
import
events
from
'../events'
;
function
getExistingAnnotation
(
store
,
id
)
{
return
store
.
getState
().
annotations
.
annotations
.
find
(
function
(
annot
)
{
...
...
@@ -10,7 +10,7 @@ function getExistingAnnotation(store, id) {
// Wraps the annotation store to trigger events for the CRUD actions
// @ngInject
function
annotationMapper
(
$rootScope
,
store
,
api
)
{
export
default
function
annotationMapper
(
$rootScope
,
store
,
api
)
{
function
loadAnnotations
(
annotations
,
replies
)
{
annotations
=
annotations
.
concat
(
replies
||
[]);
...
...
@@ -73,5 +73,3 @@ function annotationMapper($rootScope, store, api) {
flagAnnotation
:
flagAnnotation
,
};
}
module
.
exports
=
annotationMapper
;
src/sidebar/services/annotations.js
View file @
db679988
const
SearchClient
=
require
(
'../search-client'
)
;
import
SearchClient
from
'../search-client'
;
// @ngInject
function
annotations
(
annotationMapper
,
api
,
store
,
streamer
,
streamFilter
)
{
export
default
function
annotations
(
annotationMapper
,
api
,
store
,
streamer
,
streamFilter
)
{
let
searchClient
=
null
;
/**
...
...
@@ -57,5 +63,3 @@ function annotations(annotationMapper, api, store, streamer, streamFilter) {
load
,
};
}
module
.
exports
=
annotations
;
src/sidebar/services/api-routes.js
View file @
db679988
const
{
retryPromiseOperation
}
=
require
(
'../util/retry'
)
;
import
{
retryPromiseOperation
}
from
'../util/retry'
;
/**
* A service which fetches and caches API route metadata.
*/
// @ngInject
function
apiRoutes
(
settings
)
{
export
default
function
apiRoutes
(
settings
)
{
// Cache of route name => route metadata from API root.
let
routeCache
;
// Cache of links to pages on the service fetched from the API's "links"
...
...
@@ -57,5 +57,3 @@ function apiRoutes(settings) {
return
{
routes
,
links
};
}
module
.
exports
=
apiRoutes
;
src/sidebar/services/api.js
View file @
db679988
const
get
=
require
(
'lodash.get'
)
;
const
queryString
=
require
(
'query-string'
)
;
import
get
from
'lodash.get'
;
import
*
as
queryString
from
'query-string'
;
const
{
replaceURLParams
}
=
require
(
'../util/url'
)
;
import
{
replaceURLParams
}
from
'../util/url'
;
/**
* Translate the response from a failed API call into an Error-like object.
...
...
@@ -189,7 +189,7 @@ function createAPICall(
* not use authentication.
*/
// @ngInject
function
api
(
apiRoutes
,
auth
,
store
)
{
export
default
function
api
(
apiRoutes
,
auth
,
store
)
{
const
links
=
apiRoutes
.
routes
();
let
clientId
=
null
;
...
...
@@ -247,5 +247,3 @@ function api(apiRoutes, auth, store) {
// from the `apiRoutes` service.
};
}
module
.
exports
=
api
;
src/sidebar/services/features.js
View file @
db679988
...
...
@@ -9,12 +9,13 @@
* change at any time and should write code accordingly. Feature flags should
* not be cached, and should not be interrogated only at setup time.
*/
const
events
=
require
(
'../events'
);
const
bridgeEvents
=
require
(
'../../shared/bridge-events'
);
const
warnOnce
=
require
(
'../../shared/warn-once'
);
import
bridgeEvents
from
'../../shared/bridge-events'
;
import
warnOnce
from
'../../shared/warn-once'
;
import
events
from
'../events'
;
// @ngInject
function
features
(
$rootScope
,
bridge
,
session
)
{
export
default
function
features
(
$rootScope
,
bridge
,
session
)
{
const
_sendFeatureFlags
=
function
()
{
const
userFeatures
=
session
.
state
.
features
;
bridge
.
call
(
bridgeEvents
.
FEATURE_FLAGS_UPDATED
,
userFeatures
||
{});
...
...
@@ -59,5 +60,3 @@ function features($rootScope, bridge, session) {
flagEnabled
:
flagEnabled
,
};
}
module
.
exports
=
features
;
src/sidebar/services/flash.js
View file @
db679988
...
...
@@ -3,7 +3,7 @@
*/
// @ngInject
function
flash
(
toastr
)
{
export
default
function
flash
(
toastr
)
{
return
{
info
:
toastr
.
info
.
bind
(
toastr
),
success
:
toastr
.
success
.
bind
(
toastr
),
...
...
@@ -11,5 +11,3 @@ function flash(toastr) {
error
:
toastr
.
error
.
bind
(
toastr
),
};
}
module
.
exports
=
flash
;
src/sidebar/services/frame-sync.js
View file @
db679988
const
debounce
=
require
(
'lodash.debounce'
)
;
import
debounce
from
'lodash.debounce'
;
const
events
=
require
(
'../events'
)
;
const
bridgeEvents
=
require
(
'../../shared/bridge-events'
)
;
const
metadata
=
require
(
'../util/annotation-metadata'
)
;
const
uiConstants
=
require
(
'../ui-constants'
)
;
import
bridgeEvents
from
'../../shared/bridge-events'
;
import
events
from
'../events'
;
import
uiConstants
from
'../ui-constants'
;
import
*
as
metadata
from
'../util/annotation-metadata'
;
/**
* @typedef FrameInfo
...
...
src/sidebar/services/groups.js
View file @
db679988
...
...
@@ -11,13 +11,13 @@ const DEFAULT_ORGANIZATION = {
encodeURIComponent
(
require
(
'../../images/icons/logo.svg'
)),
};
const
events
=
require
(
'../events'
)
;
const
{
awaitStateChange
}
=
require
(
'../util/state'
)
;
const
{
combineGroups
}
=
require
(
'../util/groups'
)
;
const
serviceConfig
=
require
(
'../service-config'
)
;
import
events
from
'../events'
;
import
serviceConfig
from
'../service-config'
;
import
{
combineGroups
}
from
'../util/groups'
;
import
{
awaitStateChange
}
from
'../util/state'
;
// @ngInject
function
groups
(
export
default
function
groups
(
$rootScope
,
store
,
api
,
...
...
@@ -372,5 +372,3 @@ function groups(
focus
:
focus
,
};
}
module
.
exports
=
groups
;
src/sidebar/services/local-storage.js
View file @
db679988
...
...
@@ -25,7 +25,7 @@ class InMemoryStorage {
* in third-party iframes.
*/
// @ngInject
function
localStorage
(
$window
)
{
export
default
function
localStorage
(
$window
)
{
let
storage
;
let
testKey
=
'hypothesis.testKey'
;
...
...
@@ -63,5 +63,3 @@ function localStorage($window) {
},
};
}
module
.
exports
=
localStorage
;
src/sidebar/services/oauth-auth.js
View file @
db679988
const
events
=
require
(
'../events'
)
;
const
{
resolve
}
=
require
(
'../util/url'
)
;
const
serviceConfig
=
require
(
'../service-config'
)
;
import
events
from
'../events'
;
import
serviceConfig
from
'../service-config'
;
import
{
resolve
}
from
'../util/url'
;
/**
* @typedef RefreshOptions
...
...
@@ -21,7 +21,7 @@ const serviceConfig = require('../service-config');
* Interaction with OAuth endpoints in the annotation service is delegated to
* the `OAuthClient` class.
*/
function
auth
(
export
default
function
auth
(
$rootScope
,
$window
,
OAuthClient
,
...
...
@@ -311,5 +311,3 @@ auth.$inject = [
'localStorage'
,
'settings'
,
];
module
.
exports
=
auth
;
src/sidebar/services/permissions.js
View file @
db679988
...
...
@@ -23,7 +23,7 @@ const STORAGE_KEY = 'hypothesis.privacy';
* annotations to local storage.
*/
// @ngInject
function
Permissions
(
localStorage
)
{
export
default
function
Permissions
(
localStorage
)
{
const
self
=
this
;
function
defaultLevel
()
{
...
...
@@ -125,5 +125,3 @@ function Permissions(localStorage) {
return
perms
[
action
].
indexOf
(
userid
)
!==
-
1
;
};
}
module
.
exports
=
Permissions
;
src/sidebar/services/root-thread.js
View file @
db679988
const
buildThread
=
require
(
'../build-thread'
)
;
const
events
=
require
(
'../events'
)
;
const
memoize
=
require
(
'../util/memoize'
)
;
const
metadata
=
require
(
'../util/annotation-metadata'
)
;
const
tabs
=
require
(
'../util/tabs'
)
;
import
buildThread
from
'../build-thread'
;
import
events
from
'../events'
;
import
*
as
metadata
from
'../util/annotation-metadata'
;
import
memoize
from
'../util/memoize'
;
import
*
as
tabs
from
'../util/tabs'
;
function
truthyKeys
(
map
)
{
return
Object
.
keys
(
map
).
filter
(
function
(
k
)
{
...
...
@@ -37,7 +37,12 @@ const sortFns = {
* The root thread is then displayed by viewer.html
*/
// @ngInject
function
RootThread
(
$rootScope
,
store
,
searchFilter
,
viewFilter
)
{
export
default
function
RootThread
(
$rootScope
,
store
,
searchFilter
,
viewFilter
)
{
/**
* Build the root conversation thread from the given UI state.
*
...
...
@@ -145,5 +150,3 @@ function RootThread($rootScope, store, searchFilter, viewFilter) {
*/
this
.
thread
=
memoize
(
buildRootThread
);
}
module
.
exports
=
RootThread
;
src/sidebar/services/search-filter.js
View file @
db679988
...
...
@@ -259,11 +259,9 @@ function generateFacetedFilter(searchtext, focusFilters = {}) {
* filter annotations displayed to the user or fetched from the API.
*/
// @ngInject
function
searchFilter
()
{
export
default
function
searchFilter
()
{
return
{
toObject
,
generateFacetedFilter
,
};
}
module
.
exports
=
searchFilter
;
src/sidebar/services/service-url.js
View file @
db679988
const
urlUtil
=
require
(
'../util/url'
)
;
import
*
as
urlUtil
from
'../util/url'
;
/**
* A function that returns an absolute URL given a link name and params, by
...
...
@@ -31,7 +31,7 @@ const urlUtil = require('../util/url');
*
* @ngInject
*/
function
serviceUrl
(
store
,
apiRoutes
)
{
export
default
function
serviceUrl
(
store
,
apiRoutes
)
{
apiRoutes
.
links
()
.
then
(
store
.
updateLinks
)
...
...
@@ -63,5 +63,3 @@ function serviceUrl(store, apiRoutes) {
return
url
.
url
;
};
}
module
.
exports
=
serviceUrl
;
src/sidebar/services/session.js
View file @
db679988
const
events
=
require
(
'../events'
)
;
const
retryUtil
=
require
(
'../util/retry'
)
;
const
sentry
=
require
(
'../util/sentry'
)
;
import
events
from
'../events'
;
import
*
as
retryUtil
from
'../util/retry'
;
import
*
as
sentry
from
'../util/sentry'
;
const
CACHE_TTL
=
5
*
60
*
1000
;
// 5 minutes
...
...
@@ -19,7 +19,7 @@ const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
*
* @ngInject
*/
function
session
(
export
default
function
session
(
$rootScope
,
analytics
,
store
,
...
...
@@ -188,5 +188,3 @@ function session(
update
,
};
}
module
.
exports
=
session
;
src/sidebar/services/stream-filter.js
View file @
db679988
...
...
@@ -5,7 +5,7 @@
* See https://github.com/hypothesis/h/blob/master/h/streamer/filter.py
* for the schema.
*/
class
StreamFilter
{
export
default
class
StreamFilter
{
constructor
()
{
this
.
resetFilter
();
}
...
...
@@ -47,5 +47,3 @@ class StreamFilter {
return
this
;
}
}
module
.
exports
=
StreamFilter
;
src/sidebar/services/streamer.js
View file @
db679988
const
queryString
=
require
(
'query-string'
)
;
const
uuid
=
require
(
'node-uuid'
)
;
import
uuid
from
'node-uuid'
;
import
*
as
queryString
from
'query-string'
;
const
warnOnce
=
require
(
'../../shared/warn-once'
);
const
Socket
=
require
(
'../websocket'
);
import
warnOnce
from
'../../shared/warn-once'
;
import
Socket
from
'../websocket'
;
/**
* Open a new WebSocket connection to the Hypothesis push notification service.
...
...
@@ -19,7 +18,7 @@ const Socket = require('../websocket');
* @param settings - Application settings
*/
// @ngInject
function
Streamer
(
export
default
function
Streamer
(
$rootScope
,
annotationMapper
,
store
,
...
...
@@ -236,5 +235,3 @@ function Streamer(
this
.
reconnect
=
reconnect
;
this
.
setConfig
=
setConfig
;
}
module
.
exports
=
Streamer
;
src/sidebar/services/tags.js
View file @
db679988
...
...
@@ -13,7 +13,7 @@
* on frequency of usage.
*/
// @ngInject
function
tags
(
localStorage
)
{
export
default
function
tags
(
localStorage
)
{
const
TAGS_LIST_KEY
=
'hypothesis.user.tags.list'
;
const
TAGS_MAP_KEY
=
'hypothesis.user.tags.map'
;
...
...
@@ -78,5 +78,3 @@ function tags(localStorage) {
store
,
};
}
module
.
exports
=
tags
;
src/sidebar/services/test/analytics-test.js
View file @
db679988
const
analyticsService
=
require
(
'../analytics'
)
;
import
analyticsService
from
'../analytics'
;
describe
(
'analytics'
,
function
()
{
let
$windowStub
;
...
...
src/sidebar/services/test/annotation-mapper-test.js
View file @
db679988
const
angular
=
require
(
'angular'
)
;
const
immutable
=
require
(
'seamless-immutable'
)
;
import
angular
from
'angular'
;
import
immutable
from
'seamless-immutable'
;
const
annotationMapperFactory
=
require
(
'../annotation-mapper'
)
;
const
storeFactory
=
require
(
'../../store'
)
;
const
events
=
require
(
'../../events'
)
;
import
events
from
'../../events'
;
import
storeFactory
from
'../../store'
;
import
annotationMapperFactory
from
'../annotation-mapper'
;
describe
(
'annotationMapper'
,
function
()
{
const
sandbox
=
sinon
.
createSandbox
();
...
...
src/sidebar/services/test/annotations-test.js
View file @
db679988
const
EventEmitter
=
require
(
'tiny-emitter'
)
;
import
EventEmitter
from
'tiny-emitter'
;
const
annotations
=
require
(
'../annotations'
)
;
const
{
$imports
}
=
require
(
'../annotations'
)
;
import
annotations
from
'../annotations'
;
import
{
$imports
}
from
'../annotations'
;
let
searchClients
;
let
longRunningSearchClient
=
false
;
...
...
src/sidebar/services/test/api-routes-test.js
View file @
db679988
const
apiRoutesFactory
=
require
(
'../api-routes'
)
;
import
apiRoutesFactory
from
'../api-routes'
;
// Abridged version of the response returned by https://hypothes.is/api,
// with the domain name changed.
...
...
src/sidebar/services/test/api-test.js
View file @
db679988
const
fetchMock
=
require
(
'fetch-mock'
)
;
import
fetchMock
from
'fetch-mock'
;
const
apiFactory
=
require
(
'../api'
)
;
import
apiFactory
from
'../api'
;
// API route directory.
//
...
...
src/sidebar/services/test/features-test.js
View file @
db679988
const
features
=
require
(
'../features'
)
;
const
{
$imports
}
=
require
(
'../features'
)
;
const
events
=
require
(
'../../events'
)
;
const
bridgeEvents
=
require
(
'../../../shared/bridge-events'
)
;
import
bridgeEvents
from
'../../../shared/bridge-events'
;
import
events
from
'../../events'
;
import
features
from
'../features'
;
import
{
$imports
}
from
'../features'
;
describe
(
'h:features - sidebar layer'
,
function
()
{
let
fakeBridge
;
...
...
src/sidebar/services/test/flash-test.js
View file @
db679988
const
flash
=
require
(
'../flash'
)
;
import
flash
from
'../flash'
;
describe
(
'sidebar.flash'
,
()
=>
{
[
'info'
,
'success'
,
'warning'
,
'error'
].
forEach
(
method
=>
{
...
...
src/sidebar/services/test/frame-sync-test.js
View file @
db679988
const
angular
=
require
(
'angular'
)
;
const
EventEmitter
=
require
(
'tiny-emitter'
)
;
const
annotationFixtures
=
require
(
'../../test/annotation-fixtures'
)
;
const
events
=
require
(
'../../events'
)
;
const
createFakeStore
=
require
(
'../../test/fake-redux-store'
)
;
const
{
default
:
FrameSync
,
formatAnnot
}
=
require
(
'../frame-sync'
)
;
const
uiConstants
=
require
(
'../../ui-constants'
)
;
import
angular
from
'angular'
;
import
EventEmitter
from
'tiny-emitter'
;
import
events
from
'../../events'
;
import
*
as
annotationFixtures
from
'../../test/annotation-fixtures'
;
import
createFakeStore
from
'../../test/fake-redux-store'
;
import
uiConstants
from
'../../ui-constants'
;
import
FrameSync
,
{
formatAnnot
}
from
'../frame-sync'
;
const
fixtures
=
{
ann
:
Object
.
assign
({
$tag
:
't1'
},
annotationFixtures
.
defaultAnnotation
()),
...
...
src/sidebar/services/test/groups-test.js
View file @
db679988
const
events
=
require
(
'../../events'
)
;
const
fakeReduxStore
=
require
(
'../../test/fake-redux-store'
)
;
const
groups
=
require
(
'../groups'
)
;
import
events
from
'../../events'
;
import
fakeReduxStore
from
'../../test/fake-redux-store'
;
import
groups
from
'../groups'
;
/**
* Generate a truth table containing every possible combination of a set of
...
...
src/sidebar/services/test/local-storage-test.js
View file @
db679988
const
angular
=
require
(
'angular'
);
const
service
=
require
(
'../local-storage'
);
import
angular
from
'angular'
;
import
service
from
'../local-storage'
;
function
windowWithLocalStoragePropertyThatThrows
()
{
const
win
=
{};
...
...
src/sidebar/services/test/oauth-auth-test.js
View file @
db679988
const
angular
=
require
(
'angular'
)
;
import
angular
from
'angular'
;
const
authFactory
=
require
(
'../oauth-auth'
);
const
events
=
require
(
'../../events'
);
const
FakeWindow
=
require
(
'../../util/test/fake-window'
);
import
events
from
'../../events'
;
import
FakeWindow
from
'../../util/test/fake-window'
;
import
authFactory
from
'../oauth-auth'
;
const
DEFAULT_TOKEN_EXPIRES_IN_SECS
=
1000
;
const
TOKEN_KEY
=
'hypothesis.oauth.hypothes%2Eis.token'
;
...
...
src/sidebar/services/test/permissions-test.js
View file @
db679988
const
Permissions
=
require
(
'../permissions'
)
;
import
Permissions
from
'../permissions'
;
const
userid
=
'acct:flash@gord.on'
;
...
...
src/sidebar/services/test/root-thread-test.js
View file @
db679988
const
angular
=
require
(
'angular'
)
;
const
immutable
=
require
(
'seamless-immutable'
)
;
const
annotationFixtures
=
require
(
'../../test/annotation-fixtures'
)
;
const
events
=
require
(
'../../events'
)
;
const
uiConstants
=
require
(
'../../ui-constants'
)
;
const
rootThreadFactory
=
require
(
'../root-thread'
)
;
const
{
$imports
}
=
require
(
'../root-thread'
)
;
import
angular
from
'angular'
;
import
immutable
from
'seamless-immutable'
;
import
events
from
'../../events'
;
import
*
as
annotationFixtures
from
'../../test/annotation-fixtures'
;
import
uiConstants
from
'../../ui-constants'
;
import
rootThreadFactory
from
'../root-thread'
;
import
{
$imports
}
from
'../root-thread'
;
const
fixtures
=
immutable
({
emptyThread
:
{
...
...
src/sidebar/services/test/search-filter-test.js
View file @
db679988
const
searchFilterFactory
=
require
(
'../search-filter'
)
;
import
searchFilterFactory
from
'../search-filter'
;
const
searchFilter
=
searchFilterFactory
();
...
...
src/sidebar/services/test/service-url-test.js
View file @
db679988
const
serviceUrlFactory
=
require
(
'../service-url'
)
;
const
{
$imports
}
=
require
(
'../service-url'
)
;
import
serviceUrlFactory
from
'../service-url'
;
import
{
$imports
}
from
'../service-url'
;
/** Return a fake store object. */
function
fakeStore
()
{
...
...
src/sidebar/services/test/session-test.js
View file @
db679988
const
angular
=
require
(
'angular'
)
;
import
angular
from
'angular'
;
const
events
=
require
(
'../../events'
)
;
const
{
events
:
analyticsEvents
}
=
require
(
'../analytics'
)
;
const
sessionFactory
=
require
(
'../session'
)
;
const
{
$imports
}
=
require
(
'../session'
)
;
import
events
from
'../../events'
;
import
{
events
as
analyticsEvents
}
from
'../analytics'
;
import
sessionFactory
from
'../session'
;
import
{
$imports
}
from
'../session'
;
const
mock
=
angular
.
mock
;
...
...
src/sidebar/services/test/stream-filter-test.js
View file @
db679988
const
StreamFilter
=
require
(
'../stream-filter'
)
;
import
StreamFilter
from
'../stream-filter'
;
describe
(
'sidebar/services/stream-filter'
,
()
=>
{
describe
(
'#addClause'
,
()
=>
{
...
...
src/sidebar/services/test/streamer-test.js
View file @
db679988
const
EventEmitter
=
require
(
'tiny-emitter'
)
;
import
EventEmitter
from
'tiny-emitter'
;
const
Streamer
=
require
(
'../streamer'
)
;
const
{
$imports
}
=
require
(
'../streamer'
)
;
import
Streamer
from
'../streamer'
;
import
{
$imports
}
from
'../streamer'
;
const
fixtures
=
{
createNotification
:
{
...
...
src/sidebar/services/test/tags-test.js
View file @
db679988
const
angular
=
require
(
'angular'
)
;
import
angular
from
'angular'
;
const
tagsFactory
=
require
(
'../tags'
)
;
import
tagsFactory
from
'../tags'
;
const
TAGS_LIST_KEY
=
'hypothesis.user.tags.list'
;
const
TAGS_MAP_KEY
=
'hypothesis.user.tags.map'
;
...
...
src/sidebar/services/test/unicode-test.js
View file @
db679988
const
unicodeFactory
=
require
(
'../unicode'
)
;
import
unicodeFactory
from
'../unicode'
;
const
unicode
=
unicodeFactory
();
...
...
src/sidebar/services/test/view-filter-test.js
View file @
db679988
const
ViewFilter
=
require
(
'../view-filter'
)
;
import
ViewFilter
from
'../view-filter'
;
function
isoDateWithAge
(
age
)
{
return
new
Date
(
Date
.
now
()
-
age
*
1000
).
toISOString
();
...
...
src/sidebar/services/unicode.js
View file @
db679988
...
...
@@ -10,11 +10,9 @@
const
COMBINING_MARKS
=
/
[\u
0300-
\u
036F
\u
0483-
\u
0489
\u
0591-
\u
05BD
\u
05BF
\u
05C1
\u
05C2
\u
05C4
\u
05C5
\u
05C7
\u
0610-
\u
061A
\u
064B-
\u
065F
\u
0670
\u
06D6-
\u
06DC
\u
06DF-
\u
06E4
\u
06E7
\u
06E8
\u
06EA-
\u
06ED
\u
0711
\u
0730-
\u
074A
\u
07A6-
\u
07B0
\u
07EB-
\u
07F3
\u
0816-
\u
0819
\u
081B-
\u
0823
\u
0825-
\u
0827
\u
0829-
\u
082D
\u
0859-
\u
085B
\u
08E4-
\u
08FE
\u
0900-
\u
0903
\u
093A-
\u
093C
\u
093E-
\u
094F
\u
0951-
\u
0957
\u
0962
\u
0963
\u
0981-
\u
0983
\u
09BC
\u
09BE-
\u
09C4
\u
09C7
\u
09C8
\u
09CB-
\u
09CD
\u
09D7
\u
09E2
\u
09E3
\u
0A01-
\u
0A03
\u
0A3C
\u
0A3E-
\u
0A42
\u
0A47
\u
0A48
\u
0A4B-
\u
0A4D
\u
0A51
\u
0A70
\u
0A71
\u
0A75
\u
0A81-
\u
0A83
\u
0ABC
\u
0ABE-
\u
0AC5
\u
0AC7-
\u
0AC9
\u
0ACB-
\u
0ACD
\u
0AE2
\u
0AE3
\u
0B01-
\u
0B03
\u
0B3C
\u
0B3E-
\u
0B44
\u
0B47
\u
0B48
\u
0B4B-
\u
0B4D
\u
0B56
\u
0B57
\u
0B62
\u
0B63
\u
0B82
\u
0BBE-
\u
0BC2
\u
0BC6-
\u
0BC8
\u
0BCA-
\u
0BCD
\u
0BD7
\u
0C01-
\u
0C03
\u
0C3E-
\u
0C44
\u
0C46-
\u
0C48
\u
0C4A-
\u
0C4D
\u
0C55
\u
0C56
\u
0C62
\u
0C63
\u
0C82
\u
0C83
\u
0CBC
\u
0CBE-
\u
0CC4
\u
0CC6-
\u
0CC8
\u
0CCA-
\u
0CCD
\u
0CD5
\u
0CD6
\u
0CE2
\u
0CE3
\u
0D02
\u
0D03
\u
0D3E-
\u
0D44
\u
0D46-
\u
0D48
\u
0D4A-
\u
0D4D
\u
0D57
\u
0D62
\u
0D63
\u
0D82
\u
0D83
\u
0DCA
\u
0DCF-
\u
0DD4
\u
0DD6
\u
0DD8-
\u
0DDF
\u
0DF2
\u
0DF3
\u
0E31
\u
0E34-
\u
0E3A
\u
0E47-
\u
0E4E
\u
0EB1
\u
0EB4-
\u
0EB9
\u
0EBB
\u
0EBC
\u
0EC8-
\u
0ECD
\u
0F18
\u
0F19
\u
0F35
\u
0F37
\u
0F39
\u
0F3E
\u
0F3F
\u
0F71-
\u
0F84
\u
0F86
\u
0F87
\u
0F8D-
\u
0F97
\u
0F99-
\u
0FBC
\u
0FC6
\u
102B-
\u
103E
\u
1056-
\u
1059
\u
105E-
\u
1060
\u
1062-
\u
1064
\u
1067-
\u
106D
\u
1071-
\u
1074
\u
1082-
\u
108D
\u
108F
\u
109A-
\u
109D
\u
135D-
\u
135F
\u
1712-
\u
1714
\u
1732-
\u
1734
\u
1752
\u
1753
\u
1772
\u
1773
\u
17B4-
\u
17D3
\u
17DD
\u
180B-
\u
180D
\u
18A9
\u
1920-
\u
192B
\u
1930-
\u
193B
\u
19B0-
\u
19C0
\u
19C8
\u
19C9
\u
1A17-
\u
1A1B
\u
1A55-
\u
1A5E
\u
1A60-
\u
1A7C
\u
1A7F
\u
1B00-
\u
1B04
\u
1B34-
\u
1B44
\u
1B6B-
\u
1B73
\u
1B80-
\u
1B82
\u
1BA1-
\u
1BAD
\u
1BE6-
\u
1BF3
\u
1C24-
\u
1C37
\u
1CD0-
\u
1CD2
\u
1CD4-
\u
1CE8
\u
1CED
\u
1CF2-
\u
1CF4
\u
1DC0-
\u
1DE6
\u
1DFC-
\u
1DFF
\u
20D0-
\u
20F0
\u
2CEF-
\u
2CF1
\u
2D7F
\u
2DE0-
\u
2DFF
\u
302A-
\u
302F
\u
3099
\u
309A
\u
A66F-
\u
A672
\u
A674-
\u
A67D
\u
A69F
\u
A6F0
\u
A6F1
\u
A802
\u
A806
\u
A80B
\u
A823-
\u
A827
\u
A880
\u
A881
\u
A8B4-
\u
A8C4
\u
A8E0-
\u
A8F1
\u
A926-
\u
A92D
\u
A947-
\u
A953
\u
A980-
\u
A983
\u
A9B3-
\u
A9C0
\u
AA29-
\u
AA36
\u
AA43
\u
AA4C
\u
AA4D
\u
AA7B
\u
AAB0
\u
AAB2-
\u
AAB4
\u
AAB7
\u
AAB8
\u
AABE
\u
AABF
\u
AAC1
\u
AAEB-
\u
AAEF
\u
AAF5
\u
AAF6
\u
ABE3-
\u
ABEA
\u
ABEC
\u
ABED
\u
FB1E
\u
FE00-
\u
FE0F
\u
FE20-
\u
FE26
]
/g
;
// @ngInject
function
unicode
()
{
export
default
function
unicode
()
{
return
{
normalize
:
str
=>
str
.
normalize
(
'NFKD'
),
fold
:
str
=>
str
.
replace
(
COMBINING_MARKS
,
''
),
};
}
module
.
exports
=
unicode
;
src/sidebar/services/view-filter.js
View file @
db679988
const
{
quote
}
=
require
(
'../util/annotation-metadata'
)
;
import
{
quote
}
from
'../util/annotation-metadata'
;
// Prevent Babel inserting helper code after `@ngInject` comment below which
// breaks browserify-ngannotate.
...
...
@@ -20,7 +20,7 @@ function displayName(ann) {
* which do not match the filter are then hidden.
*/
// @ngInject
function
viewFilter
(
unicode
)
{
export
default
function
viewFilter
(
unicode
)
{
/**
* Normalize a field value or query term for comparison.
*/
...
...
@@ -176,5 +176,3 @@ function viewFilter(unicode) {
.
map
(
ann
=>
ann
.
id
);
};
}
module
.
exports
=
viewFilter
;
src/sidebar/test/integration/threading-test.js
View file @
db679988
const
angular
=
require
(
'angular'
)
;
const
immutable
=
require
(
'seamless-immutable'
)
;
import
angular
from
'angular'
;
import
immutable
from
'seamless-immutable'
;
const
storeFactory
=
require
(
'../../store'
)
;
const
rootThreadFactory
=
require
(
'../../services/root-thread'
)
;
const
searchFilterFactory
=
require
(
'../../services/search-filter'
)
;
const
viewFilterFactory
=
require
(
'../../services/view-filter'
)
;
import
rootThreadFactory
from
'../../services/root-thread'
;
import
searchFilterFactory
from
'../../services/search-filter'
;
import
viewFilterFactory
from
'../../services/view-filter'
;
import
storeFactory
from
'../../store'
;
const
fixtures
=
immutable
({
annotations
:
[
...
...
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