mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 02:35:23 -04:00
fix(note): fix type for owner param
To make the create method easier to use in conjunction with the authentication framework, this commit changes the type of the `owner` parameter from `User | undefined` to `User | null`. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
c675dd0e9e
commit
b9d3c95d2d
14 changed files with 69 additions and 58 deletions
|
@ -92,7 +92,12 @@ export class Note {
|
|||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
private constructor() {}
|
||||
|
||||
public static create(owner?: User, alias?: string): Omit<Note, 'id'> {
|
||||
/**
|
||||
* Creates a new Note
|
||||
* @param owner The owner of the note
|
||||
* @param alias Optional primary alias
|
||||
*/
|
||||
public static create(owner: User | null, alias?: string): Omit<Note, 'id'> {
|
||||
const newNote = new Note();
|
||||
newNote.publicId = generatePublicId();
|
||||
newNote.aliases = alias
|
||||
|
@ -101,7 +106,7 @@ export class Note {
|
|||
newNote.userPermissions = [];
|
||||
newNote.groupPermissions = [];
|
||||
newNote.viewCount = 0;
|
||||
newNote.owner = owner ?? null;
|
||||
newNote.owner = owner;
|
||||
newNote.revisions = Promise.resolve([]);
|
||||
newNote.historyEntries = [];
|
||||
newNote.mediaUploads = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue