Commit Graph

39 Commits

Author SHA1 Message Date
James Tsai 07f32f5bbf Fix standard
Signed-off-by: James Tsai <jamesscamel@gmail.com>
2020-07-01 11:42:28 +08:00
BoHong Li d5d0f3d820
fix: extractProfileAttribute not working correctly
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2020-02-28 01:53:25 +08:00
Max Wu 98fa323b15 fix (test): update CSP tests for CDN directives and file hash
Signed-off-by: Max Wu <jackymaxj@gmail.com>
2020-02-26 22:36:25 +08:00
BoHong Li 2135cfcd18
refactor: move realtime related code to directory
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2020-01-06 14:19:02 +08:00
TAKIMOTO, Atsushi c7a15ecc66 Add allowAnonymousViews option
resolve #1144
set to `false` to delete `freely`, `editable` and `locked` permission when allowAnonymous is true (default is `true`)
Signed-off-by: hakoai <hakoai64@gmail.com>
2019-09-08 21:55:52 +09:00
BoHong Li f5c73d3439
refactor: fix lint on test/realtime/updateNote.test.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-08-04 23:56:35 +08:00
BoHong Li 5f5a26c497
refactor: fix lint on test/realtime/socket-events.test.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-08-04 23:56:35 +08:00
BoHong Li 8fc2059a09
refactor: fix lint on test/realtime/extractNoteIdFromSocket.test.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-08-04 23:56:34 +08:00
BoHong Li eaef11507c
refactor: fix lint on test/realtime/dirtyNoteUpdate.test.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-08-04 23:56:34 +08:00
BoHong Li 4d036b50a2
refactor: fix lint on test/realtime/connection.test.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-08-04 23:56:34 +08:00
BoHong Li 45f0bfa5d8
refactor: fix lint on test/realtime/cleanDanglingUser.test.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-08-04 23:56:33 +08:00
BoHong Li a7b4c30134
refactor: fix lint on test/csp.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-08-04 23:56:33 +08:00
BoHong Li ac8160c650
refactor: fix lint on test/letter-avaters.js
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-08-04 23:56:25 +08:00
BoHong Li 79af236405
test: Note.update should returns an array
Signed-off-by: BoHong Li <raccoon@hackmd.io>
2019-07-30 18:32:31 +08:00
BoHong Li a6036cb70b
refactor: back to use js-standard
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:08 +08:00
BoHong Li 1ac6434ab7
refactor(realtime): parseNoteIdFromSocket to async-await style function
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:08 +08:00
BoHong Li 17e82c11c9
refactor(realtime): connection flow to queue
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:07 +08:00
BoHong Li 0b03b8e9ba
refactor(realtime): ifMayEdit
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:07 +08:00
BoHong Li e773182db0
refactor(realtime): updateNote
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:07 +08:00
BoHong Li 2dedc84e28
refactor(realtime): extract "save note as revision" to job
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:06 +08:00
BoHong Li ab37a33e0b
refactor(realtime): add test case for clean dangling user
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:06 +08:00
BoHong Li d8b18ee241
refactor(realtime): disconnect flow
1. use queue for queueing disconnect request

Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:06 +08:00
BoHong Li 0352057c8b
refactor(realtime): extract "update dirty note" to new job
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:05 +08:00
BoHong Li 702fc48fa8
refactor(realtime): extract "SocketClient" to separate class "RealtimeClientConnection"
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:05 +08:00
BoHong Li f317171aa0
refactor(realtime): extract user event "permission" to SocketClient
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:05 +08:00
BoHong Li 968c12ff6c
refactor(realtime: extract user event "delete" to SocketClient
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:04 +08:00
BoHong Li 79666aeec3
refactor(realtime): separate test case to individually file
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:04 +08:00
BoHong Li b17f417af4
feat(realtime): add queue for connect and disconnect queue
Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:04 +08:00
BoHong Li ff72d99269
refactor(realtime): extract user event "online users" to SocketClient
1. extract user event "online users" to SocketClient
2. add test case for that

Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:04 +08:00
BoHong Li c4276e1c28
refactor(realtime): extract user event "online users" to SocketClient
1. extract user event "online users" to SocketClient
2. add test case for that

Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:03 +08:00
BoHong Li b33c91f41d
refactor(realtime): extract user event "version" to SocketClient
1. extract user event "version" to SocketClient
2. add test case for that

Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:03 +08:00
BoHong Li 3259bd0f11
refactor(realtime): extract user event "cursor" related
1. move "cursor focus", "cursor activity", "cursor blur" event handler to SocketClient
2. add test case for that

Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:03 +08:00
BoHong Li 8171860d47
refactor(realtime): extract user event "disconnect" to ClientSocket
1. extract user event "disconnect" to ClientSocket
2. add test case

Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:02 +08:00
BoHong Li 48cebc0ccc
refactor(realtime): extract "refresh" and "user status" to class
1. extract client socket event handler "refresh" and "user status"
to SocketClient class
2. add testcase for this changes

Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:02 +08:00
BoHong Li 85fc2297ac
fix(realtime): compatible extractNoteIdFromSocket failed
fixed url parsed method and add testcase for extractNoteIdFromSocket

Signed-off-by: BoHong Li <a60814billy@gmail.com>
2019-05-27 17:53:02 +08:00
Sheogorath 1ee9874393
Fix names with spaces in letter-avatars
Seems like there is a possible problem when a name containing a space is
passed to this function. using urlencode on the name should fix possible
problems here.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2019-03-03 15:46:28 +01:00
Sheogorath bf229d91c6
Add linting for tests
The tests are currently not linted. This causes a different coding style
than the rest of the sources.

This patch adds the `./test` directory to the eslint testing and fixes
linting for existing tests.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2019-01-21 17:17:54 +01:00
Sheogorath d408f4c0fe
Add tests for csp.js
Since we lack of tests but got some great point to start, let's write
more tests.

This patch provides some basic tests for our CSP library. It's more an
integration than a unit test, but gets the job done.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2019-01-19 13:54:52 +01:00
Daan Sprenkels 318a37d41c Add a test for gravatar urls
Signed-off-by: Daan Sprenkels <hello@dsprenkels.com>
2018-12-22 19:09:45 +01:00