Commit graph

3685 commits

Author SHA1 Message Date
David Mehren
80a4b40a3c
Merge pull request #1261 from hedgedoc/renovate/develop-lock-file-maintenance
Lock file maintenance (develop)
2021-05-15 22:13:42 +02:00
Renovate Bot
d384ee4519
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-15 20:10:29 +00:00
David Mehren
20234fbb68
Merge pull request #1264 from hedgedoc/renovate/develop-linters
Update linters (develop)
2021-05-15 22:09:07 +02:00
Renovate Bot
38982657b0
Update linters
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-15 19:06:53 +00:00
David Mehren
41c7e8283a
Merge pull request #1271 from hedgedoc/renovate/develop-rxjs-7.x
Update dependency rxjs to v7.0.1 (develop)
2021-05-15 21:05:41 +02:00
Renovate Bot
59343e74a4
Update dependency rxjs to v7.0.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-13 21:31:38 +00:00
Yannick Bungers
9fe5498cbf
Merge pull request #1273 from hedgedoc/renovate/develop-definitelytyped
Update dependency @types/node to v13.13.52 (develop)
2021-05-13 23:30:35 +02:00
Renovate Bot
8b26557f9f
Update dependency @types/node to v13.13.52
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-12 20:40:04 +00:00
Yannick Bungers
9cb9e70123
Merge pull request #1269 from hedgedoc/removeShortID
Refactor(note): Remove shortid from note
2021-05-11 23:06:40 +02:00
Philip Molares
8c562016ab Refactor(note): Remove shortid from note
This is a 1.x relict and isn't used anymore in 2.x. All 1.x shortids will be converted to aliases on migration of 1.x to 2.x.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-11 22:49:44 +02:00
David Mehren
ac01521d82
Merge pull request #1212 from hedgedoc/eslint/customLoggerRule 2021-05-09 22:22:05 +02:00
Philip Molares
b07c3be398 Linting: Fixed wrong logger contexts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-09 22:18:41 +02:00
Philip Molares
07a4de77d7 ESLint: Add custom rule 'correct-logger-context'
This rule ensures, that the correct context is given in any logger statements.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-09 22:18:38 +02:00
David Mehren
22144f3908
Merge pull request #1258 from hedgedoc/fix/1256
AuthTokenEntity: Make validUntil not nullable
2021-05-09 22:17:01 +02:00
David Mehren
96758e9680
Merge pull request #1257 from hedgedoc/fix/1254
Remove superfluous overrideProvider statements
2021-05-09 22:07:26 +02:00
David Mehren
0d9dfc4076
AuthTokenEntity: Make validUntil not nullable
As all tokens are valid for a maximum of 2 years, the
validUntil attribute is always populated.

This updates the database schema and the DTO to reflect that.

Fixes #1256

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 22:05:47 +02:00
David Mehren
f4587cfa9b
Merge pull request #1253 from hedgedoc/renovate/develop-major-definitelytyped
Update dependency @types/bcrypt to v5 (develop)
2021-05-09 21:52:04 +02:00
Renovate Bot
cedbee5a94
Update dependency @types/bcrypt to v5
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-09 19:42:04 +00:00
David Mehren
cc851d9631
Remove superfluous overrideProvider statements
Fixes #1254

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 21:35:34 +02:00
David Mehren
c9d50cb60c
Merge pull request #1207 from hedgedoc/maintenance/ts_strict_mode 2021-05-09 21:23:59 +02:00
David Mehren
a72b4b1eb1
Add error handling in seed.ts
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:32 +02:00
David Mehren
980da1fa43
Fix nullable property types in Note DTOs
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
64f9a29f02
MediaUploadDto: Make noteId optional
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
b518583fd2
E2E Tests: Fix ESLint errors
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
30712abe31
GroupsService: Remove test obsoleted by strict mode
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
0c89d8715e
UsersService: Remove test obsoleted by strict mode
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
ea11fbff12
Ensure optional properties of AuthTokenDto are initialized
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
f0c4fbe371
Disable strict mode for tests
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
d1e352d56c
Add explicit type annotations to nullable columns
TypeORM can't correctly infer the data type on properties with a `| null` type.
This commit adds explicit type annotations.

See also https://github.com/typeorm/typeorm/issues/2567#issuecomment-408599335

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
f9a0353748
NotesService.toNoteMetadataDto: Handle undefined updateUser
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
f8efb9717e
NotesService: Fix type errors
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
3b0ffaca30
Consistently type properties as optional
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
b3e01fff7f
GroupsService: Remove null from toGroupDto return type
toGroupDto won't return null, as TS's strict mode
prevents group from being nullish

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
664a64495f
NotesController: Double-check that req.user is defined
TokenAuthGuard ensures that req.user is always
defined, but thanks to strict mode we have to check again.

In the future, we may add a custom Request type and
a custom param decorator to centralize the check.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
6aa1aa229a
NoteEntity: Allow anonymous notes
Notes created by anonymous users don't have an owner.
This commit updates the entity accordingly.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
b08a314863
MediaUploadDto: Make noteId optional
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
dc7d8ab470
MediaService: Handle unexpected backend type
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
b93f01fe57
Correctly type nullable columns
TypeORM columns with `nullable: true` can be `null` at runtime.
This commit ensures that the types of the corresponding properties reflect that.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
16ed12bfd7
MediaController: Double-check that req.user is defined
TokenAuthGuard ensures that req.user is always
defined, but thanks to strict mode we have to check again.

In the future, we may add a custom Request type and
a custom param decorator to centralize the check.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
ace1b7fad6
MeController: Double-check that req.user is defined
TokenAuthGuard ensures that req.user is always
defined, but thanks to strict mode we have to check again.

In the future, we may add a custom Request type and
a custom param decorator to centralize the check.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
e18ee1f0fe
UsersService: Remove null from toUserDto return type
toUserDto won't return null, as TS's strict mode
prevents user from being nullish

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
96f8284e64
MarkdownBody: Handle error in getOwnPropertyDescriptor
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
a04a111293
Handle config initialisation error on app bootstrap
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
994bd7ae64
HistoryService: Throw NotInDBError on empty DB result
This adds error handling to getEntryByNote, so it throws a
NotInDBError instead of (illegally, according to the type) returning
null.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
0573ce4e08
FrontendConfig DTOs: Make properties consistently optional
Some properties already have a IsOptional decorator,
this makes the properties themselves also optional

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
99103ad217
ConsoleLoggerService: Fix type of context properties
Nullish values of functionContext and classContext are handled correctly,
so the type can be adjusted

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
d9799717b5
AuthService: Fix type of toAuthTokenWithSecretDto
toAuthTokenDto does not return nor accept a nullish value anymore,
so the types can be adjusted.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:31 +02:00
David Mehren
53a0c87a53
AuthService.randomString: Throw Error instead of returning null
A string with a negative length is invalid, so we should throw here
instead of complicating the type with a possible null return value.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:30 +02:00
David Mehren
72b545fec5
AuthTokenDto: Make properties consistently optional
validUntil and lastUsed already have a IsOptional decorator,
this makes the properties themselves also optional

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:30 +02:00
David Mehren
cfaa07806b
AuthService: Throw NotInDBError on empty DB result
This adds error handling to various functions, so they throw a
NotInDBError instead of a TypeError

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 20:59:30 +02:00