Commit graph

3275 commits

Author SHA1 Message Date
David Mehren
f3f0360a95
Add custom express types
We add a custom User object into the request object. To be able to use
that object in a strongly-typed situation, we need to tell TypeScript
that it exists.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-27 16:11:27 +01:00
David Mehren
ba771fb7b6
Enable ESLint rules with type-checks
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-26 12:10:53 +01:00
David Mehren
0a337f03c5
ESLint: Remove @typescript-eslint/explicit-function-return-type rule
The rule does not seem to be enabled at all, as it is not part of the
recommended set.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-26 12:10:53 +01:00
David Mehren
3626ce9dff
ESLint: Enable @typescript-eslint/naming-convention rule
This check enforces consistent variable naming.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-26 12:10:53 +01:00
David Mehren
c3129d40e0
ESLint: Remove @typescript-eslint/interface-name-prefix rule
The check was removed from typescript-eslint and replaced by the
naming-convention rule.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-26 12:10:53 +01:00
David Mehren
6ffeb2e9c9
ESLint: Enable @typescript-eslint/return-await rule
This ensures stack traces are helpful at the cost of a slightly
lower performance (one more tick in the event loop).

Fixes #838

Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-26 12:10:51 +01:00
David Mehren
6a6dc7ea21
ESLint: Re-enable @typescript-eslint/no-explicit-any rule
Signed-off-by: David Mehren <git@herrmehren.de>
2021-02-26 12:10:05 +01:00
David Mehren
d13466a626
Merge pull request #959 from hedgedoc/renovate/develop-bcrypt-5.x
Update dependency bcrypt to v5.0.1 (develop)
2021-02-26 12:06:34 +01:00
David Mehren
30c13621a5
Merge pull request #960 from hedgedoc/renovate/develop-nestjs-packages
Update dependency @nestjs/schematics to v7.2.8 (develop)
2021-02-26 12:06:20 +01:00
Renovate Bot
022070107c
Update dependency @nestjs/schematics to v7.2.8
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-26 09:55:26 +00:00
Renovate Bot
b9f2cce548
Update dependency bcrypt to v5.0.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-26 05:34:10 +00:00
Yannick Bungers
75be4611d3
Merge pull request #953 from hedgedoc/mediaBackendErrors 2021-02-25 22:23:11 +01:00
David Mehren
25bb00c5ef
Merge pull request #950 from hedgedoc/renovate/develop-typescript-4.x 2021-02-25 21:48:49 +01:00
David Mehren
de30189ba4
Merge pull request #956 from hedgedoc/renovate/develop-linters
Update dependency eslint-config-prettier to v8.1.0 (develop)
2021-02-25 21:44:53 +01:00
Renovate Bot
7e5e366c4b
Update dependency eslint-config-prettier to v8.1.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-25 20:02:01 +00:00
David Mehren
8c784beaf8
Merge pull request #938 from hedgedoc/renovate/develop-major-linters 2021-02-25 21:00:56 +01:00
David Mehren
0dac8672f8
Merge pull request #946 from hedgedoc/renovate/develop-mkdocs-material-7.x
Update dependency mkdocs-material to v7 (develop)
2021-02-25 20:46:01 +01:00
Renovate Bot
906bf7d321
Update dependency mkdocs-material to v7
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-25 19:21:18 +00:00
David Mehren
29804ec6c2
Merge pull request #941 from hedgedoc/renovate/develop-linters
Update linters to v4.15.2 (develop)
2021-02-25 20:19:53 +01:00
Renovate Bot
4b0298e393
Update linters to v4.15.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-25 19:07:03 +00:00
David Mehren
7d2fa9205f
Merge pull request #949 from hedgedoc/renovate/develop-ts-jest-26.x
Update dependency ts-jest to v26.5.2 (develop)
2021-02-25 20:06:05 +01:00
Renovate Bot
4a33fd9fa2
Update dependency ts-jest to v26.5.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-25 19:03:08 +00:00
David Mehren
e70683eca2
Merge pull request #952 from hedgedoc/renovate/develop-rxjs-6.x
Update dependency rxjs to v6.6.6 (develop)
2021-02-25 20:01:38 +01:00
Philip Molares
31f7c76697 MediaController: Handle MediaBackendErrors
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-25 13:59:32 +01:00
Philip Molares
8365132a39 FilesystemBackend: Throw MediaBackendError where appropriate
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-25 13:52:50 +01:00
Philip Molares
bee2333f77 MediaService: Add MediaBackendError
This get's thrown when the backend can't perform the required action.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-25 13:51:54 +01:00
Renovate Bot
e021687440
Update dependency rxjs to v6.6.6
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-25 01:19:34 +00:00
David Mehren
4ab6db0031
Merge pull request #940 from hedgedoc/renovate/develop-nestjs-packages
Update NestJS packages (develop)
2021-02-24 18:08:27 +01:00
Renovate Bot
c166d5bad2
Update NestJS packages
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-24 14:12:26 +00:00
Philip Molares
ca064526a7 ConsoleLogger: Add typing to localeStringOptions
This is necessary as typescript is unable to determine that `year` in this object is of type "numeric" and not string.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-24 10:30:20 +01:00
Renovate Bot
39f4a2160a
Update dependency typescript to v4.2.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-23 23:51:55 +00:00
David Mehren
0dd1f80db4
Merge pull request #948 from hedgedoc/fix/unusedImports
PermissionsModule: Remove unused imports
2021-02-23 21:09:26 +01:00
David Mehren
3fabf2596a
Merge pull request #943 from hedgedoc/refactor/getNoteContent 2021-02-23 21:05:25 +01:00
Philip Molares
0e6cc0b971 PermissionsModule: Remove unused imports
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-23 19:13:41 +01:00
Yannick Bungers
6b88aaca45
Merge pull request #944 from hedgedoc/refactor/viewcount
Note: Rename viewcount to viewCount for compliance
2021-02-23 15:11:23 +01:00
Yannick Bungers
b7e188cec2 Rename viewcount to viewCount for compliance
Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-22 23:36:44 +01:00
Yannick Bungers
e081bd196b Rename getNoteContentByNote to getNoteContent
Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-22 22:34:18 +01:00
Yannick Bungers
15a1a138ee Remove unused getNoteContentByIdOrAlias
Signed-off-by: Yannick Bungers <git@innay.de>
2021-02-22 22:32:00 +01:00
Philip Molares
7388cafe45 ESLint: Remove prettier/@typescript-eslint
This rule no longer exists. According to the documentation on
https://github.com/prettier/eslint-config-prettier#installation this is
not needed anymore.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-21 16:51:48 +01:00
Renovate Bot
169639cf81
Update dependency eslint-config-prettier to v8
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-02-21 12:01:55 +00:00
David Mehren
3f05fa4852
Merge pull request #848 from hedgedoc/feature/noteService 2021-02-20 21:46:17 +01:00
Philip Molares
5f49cb8d48 NotesService: Replace noteByIdOrAlias with note as parameter
As the NotesController has the note already, because it checked with it if the user has the permission to perform the action, it's not necessary to get the note from the DB again, instead we should just provide the note to the functions directly.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:51:27 +01:00
Philip Molares
c9b05b3c44 NotesController: Handle new errors
Handle the AlreadyInDB and PermissionsUpdateInconsistent errors and correctly show them to the api user as BadRequest errors.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:51:27 +01:00
Philip Molares
54286d589d NotesE2ETests: Ensure posting the same note alias twice fails
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:51:27 +01:00
Philip Molares
93d859647d NotesService: Add unit tests
Fixed toUserDto method of UsersService: If a user has no email an empty string should be returned (like with the photoUrl) instead of null.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:51:24 +01:00
Philip Molares
4332b039d6 NotesService: Finished hardcoded functions
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 19:45:16 +01:00
Philip Molares
8b29e32e45 Errors: Add AlreadyInDB and PermissionsUpdateInconsistent error
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 16:54:08 +01:00
Philip Molares
34087561e7 GroupsService: Create new GroupsService
This service is necessary as we plan to have functions to create and manipulate groups in the future.
The GroupInfoDto was moved from the file note-permissions.dto.ts to mimic the UserInfoDto.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 16:52:18 +01:00
David Mehren
3b5f199ce2
Merge pull request #933 from hedgedoc/renovate/develop-definitelytyped
Update dependency @types/node to v13.13.45 (develop)
2021-02-20 11:57:06 +01:00
Philip Molares
577811be29 NotePermissions: Remove default constructors
As discussed in #835 we don't want to have default constructors and prefer .create methods.
Because the created NoteGroupPermission and NoteUserPermission are not saved to the DB by themselves, but are saved via a change to the Note using a Pick<Class, attributes>-style return type is not helpful here as every single time the .create functions are called a full object is required.
The mock calls in the PermissionService test are not needed and break the .create calls so they got removed.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-02-20 11:38:50 +01:00