mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
Rename Authorship entity to Edit
As we now have a separate Author entity, which holds information about an author (the color), the Authorship name became confusing. Edit seems to be a better name, as the entity saves information about a change in a note. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
5846ca75a9
commit
b2d37abf6c
19 changed files with 67 additions and 73 deletions
|
@ -198,8 +198,8 @@ export class NotesService {
|
|||
return await this.userRepository
|
||||
.createQueryBuilder('user')
|
||||
.innerJoin('user.authors', 'author')
|
||||
.innerJoin('author.authorships', 'authorship')
|
||||
.innerJoin('authorship.revisions', 'revision')
|
||||
.innerJoin('author.edits', 'edit')
|
||||
.innerJoin('edit.revisions', 'revision')
|
||||
.innerJoin('revision.note', 'note')
|
||||
.where('note.id = :id', { id: note.id })
|
||||
.getMany();
|
||||
|
@ -322,14 +322,14 @@ export class NotesService {
|
|||
*/
|
||||
async calculateUpdateUser(note: Note): Promise<User | null> {
|
||||
const lastRevision = await this.getLatestRevision(note);
|
||||
if (lastRevision && lastRevision.authorships) {
|
||||
// Sort the last Revisions Authorships by their updatedAt Date to get the latest one
|
||||
// the user of that Authorship is the updateUser
|
||||
return lastRevision.authorships.sort(
|
||||
if (lastRevision && lastRevision.edits) {
|
||||
// Sort the last Revisions Edits by their updatedAt Date to get the latest one
|
||||
// the user of that Edit is the updateUser
|
||||
return lastRevision.edits.sort(
|
||||
(a, b) => b.updatedAt.getTime() - a.updatedAt.getTime(),
|
||||
)[0].author.user;
|
||||
}
|
||||
// If there are no Authorships, the owner is the updateUser
|
||||
// If there are no Edits, the owner is the updateUser
|
||||
return note.owner;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue