mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00
Merge pull request #943 from hedgedoc/refactor/getNoteContent
This commit is contained in:
commit
3fabf2596a
4 changed files with 8 additions and 35 deletions
|
@ -112,7 +112,7 @@ export class NotesService {
|
|||
* @param {Note} note - the note to use
|
||||
* @return {string} the content of the note
|
||||
*/
|
||||
async getNoteContentByNote(note: Note): Promise<string> {
|
||||
async getNoteContent(note: Note): Promise<string> {
|
||||
return (await this.getLatestRevision(note)).content;
|
||||
}
|
||||
|
||||
|
@ -266,17 +266,6 @@ export class NotesService {
|
|||
return await this.noteRepository.save(note);
|
||||
}
|
||||
|
||||
/**
|
||||
* @async
|
||||
* Get the current content of the note by either their id or alias.
|
||||
* @param {string} noteIdOrAlias - the notes id or alias
|
||||
* @return {string} the content of the note
|
||||
*/
|
||||
async getNoteContentByIdOrAlias(noteIdOrAlias: string): Promise<string> {
|
||||
const note = await this.getNoteByIdOrAlias(noteIdOrAlias);
|
||||
return this.getNoteContentByNote(note);
|
||||
}
|
||||
|
||||
/**
|
||||
* @async
|
||||
* Calculate the updateUser (for the NoteDto) for a Note.
|
||||
|
@ -360,7 +349,7 @@ export class NotesService {
|
|||
*/
|
||||
async toNoteDto(note: Note): Promise<NoteDto> {
|
||||
return {
|
||||
content: await this.getNoteContentByNote(note),
|
||||
content: await this.getNoteContent(note),
|
||||
metadata: await this.toNoteMetadataDto(note),
|
||||
editedByAtPosition: [],
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue