Commit graph

2775 commits

Author SHA1 Message Date
David Mehren
908bf36fa0
Make authorships show up again
It turns out our shiny new typed ES2015 `Map`s are not serializable to JSON. :(
Luckily, we only use strings as keys and can write a function that converts them to serializable objects!

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-06-01 20:14:27 +02:00
David Mehren
17f3dc1877
realtime.ts: Minor cleanups
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-31 21:40:35 +02:00
David Mehren
d2963eedc6
realtime.ts: Fix bug in user-color setup
The code was incorrectly migrated from JavaScript set colors in the wrong way.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-31 21:40:05 +02:00
David Mehren
5c4820483c
realtime.ts: Fix bug in emitOnlineUsers()
We incorrectly iterated over Map.keys() instead of Map.values()

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-31 21:38:42 +02:00
David Mehren
cb0f5c1bed
Update yarn.lock
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-25 23:34:16 +02:00
David Mehren
9c894633a8
Many types (and corresponding changes to keek tsc happy) in realtime.ts
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-25 23:34:16 +02:00
David Mehren
591096ce8b
Add @types/codemirror
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-25 23:33:47 +02:00
Yannick Bungers
e8a34e7ced
More Types for realtime.ts
Signed-off-by: Yannick Bungers <git@innay.de>
2020-05-25 23:33:20 +02:00
David Mehren
ed9a89efb5
Type fix in User model
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-25 23:33:20 +02:00
David Mehren
2fc2219bb4
Type fix in dmpWorker
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-25 23:33:20 +02:00
David Mehren
5a6ec56a7e
Cleanups lib/web/note
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-25 23:33:20 +02:00
David Mehren
280fda1d6c
Fix note history updating 🐛
a7aaded6 started to use a Map for a users note history in various places, but didn't update the code to actually use the Map operations. This broke updating the note history.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-25 23:33:20 +02:00
Yannick Bungers
f208f3eeef
Types for realtime.ts
Signed-off-by: Yannick Bungers <git@innay.de>
2020-05-25 23:33:19 +02:00
David Mehren
d925b0cc5f
Types and lint fixes in lib/web/auth
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-24 18:38:24 +02:00
David Mehren
762e58b0d4
Do not lint migration code
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-24 18:11:47 +02:00
David Mehren
8b6d5a64f0
Types and lint fixes in lib/web/note
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-24 18:10:37 +02:00
David Mehren
b01bb93813
More types for Note
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-24 17:49:32 +02:00
David Mehren
1f517bfb99
More types for history, config/interfaces and Request.flash
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-24 17:07:13 +02:00
David Mehren
fa301ab450
Re-exclude OT code from eslint
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-23 23:24:01 +02:00
Sheogorath
7fe44cb867
Merge pull request #355 from davidmehren/tests-in-typescript
Migrate tests to typescript
2020-05-23 16:45:39 +02:00
David Mehren
1e79ef8a4e
Fix relative path in web/note/util
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-23 14:45:51 +02:00
David Mehren
a148e4d799
Add @types for sinon
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:48:15 +02:00
David Mehren
64d14bff10
More ESLint fixes
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:48:15 +02:00
David Mehren
b65ae091bd
Run eslint --fix on lib/
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:48:15 +02:00
David Mehren
7359b468e4
ESLint fixes for tests 🚨
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:48:15 +02:00
David Mehren
ac030760ba
Fix mocha tests in TypeScript
`mock-require` does not work with TypeScript, as the compiled JS expects a sub-object: `import { config } from Config` compiles to `const config_1 = require("./config")`, but the config object is now in `config_1.config`, *not* in `config_1` directly.

Therefore `mock-require` was replaced with `ts-mock-imports`, which also simplifies the code a bit.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:48:15 +02:00
David Mehren
3b8c85cc9b
Migrate tests to TypeScript
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:48:11 +02:00
David Mehren
2121e271ac
errors.ts: Convert require to import
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:11:59 +02:00
David Mehren
5cda02590b
ESLint fixes for Notes
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:11:58 +02:00
David Mehren
acdd627027
Lint .ts files too
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:11:37 +02:00
David Mehren
c164746cae
Fixes for formatting and broken rebase
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 21:11:02 +02:00
Sheogorath
6d2a70210a
Merge branch 'pr-origin-365' into release/2.0.x 2020-05-22 16:21:17 +02:00
Sheogorath
415a725484
Merge branch 'pr-origin-361' into release/2.0.x 2020-05-22 16:18:42 +02:00
David Mehren
aaff73036b
Fix remaining paths after moving everything to src
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 14:19:12 +02:00
David Mehren
3bf54999f1
Remove file extension from dmpWorker path
Node automatically loads the .js or .ts file depending on how it is run.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 14:19:12 +02:00
David Mehren
852096d1ab
Remove remaining (empty) .js files
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-22 14:19:12 +02:00
Philip Molares
8246175b5a
Only include src directory in tsconfig.json
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2020-05-22 14:19:12 +02:00
Philip Molares
fab2607e4d
Move lib and test into src directory
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2020-05-22 14:19:05 +02:00
Sheogorath
241c418ea7
Merge pull request #358 from davidmehren/more-types
More type annotations
2020-05-17 15:05:51 +02:00
Sheogorath
06cb64de31
Merge pull request #342 from SuperSandro2000/fix-links
Fix redirected, outdated links and convert all to https
2020-05-17 14:59:26 +02:00
David Mehren
798586c996
Add basic test for auth middlewares
To check for basic mistakes like broken imports, these tests try to create all middlewares (excluding SAML, because that requires a certificate file on disk)

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-16 21:16:38 +02:00
David Mehren
3262315248
Fix generateAvatarURL
Previously, we checked for `typeof email !== 'string'`. This code got turned into `email.length === 0`, which changed the behaviour of the method.
Because TypeScript makes sure that `email` is always a string, we can get rid of the check altogether.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-16 21:16:38 +02:00
David Mehren
08655f06f9
Profile.emails is now a string array 🏷️
Dropbox wrapped their email attribute in another object. We now unwrap this object in the DropboxMiddleware and don't need to special-case the email attribute in User.parsePhotoByProfile and the Profile type anymore.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-16 21:16:38 +02:00
David Mehren
9c720183aa
Fix import in DropboxMiddleware
The passport plugin does not have a default export.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-16 21:16:38 +02:00
Sheogorath
5b05760c8f
Merge pull request #356 from davidmehren/fix-history-get
setHistory: Do not parse history into an array again
2020-05-10 17:15:19 +02:00
David Mehren
6c8c5f1062
Type annotations for realtime.ts
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-09 19:59:38 +02:00
David Mehren
642ae9417c
Fix interchanged parameters in socket.io disconnect handler. 🐛
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-09 19:59:38 +02:00
David Mehren
394abe7cf8
Fix typings for connect-flash.
The `msg` argument is optional.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-09 19:59:37 +02:00
David Mehren
dcdbd3bf35
Replace processData calls with ??
Many times processData was just used to ensure a default value is present. Since TS 3.7 the nullish coalescing operator ?? is supported for that.

Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-09 19:59:37 +02:00
David Mehren
ea9cd56a20
Simplify processData
Signed-off-by: David Mehren <dmehren1@gmail.com>
2020-05-09 19:59:37 +02:00