mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 02:05:21 -04:00
fix(backend): updated realtime connection's acceptEdit, close connection based on permission
Signed-off-by: Avinash <avinash.kumar.cs92@gmail.com>
This commit is contained in:
parent
c6e283a111
commit
d15a8b18d9
2 changed files with 40 additions and 12 deletions
|
@ -191,8 +191,8 @@ export class PermissionsService {
|
|||
return false;
|
||||
}
|
||||
|
||||
private notifyOthers(noteId: Note['id']): void {
|
||||
this.eventEmitter.emit(NoteEvent.PERMISSION_CHANGE, noteId);
|
||||
private notifyOthers(note: Note): void {
|
||||
this.eventEmitter.emit(NoteEvent.PERMISSION_CHANGE, note);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -256,7 +256,7 @@ export class PermissionsService {
|
|||
createdPermission.note = Promise.resolve(note);
|
||||
(await note.groupPermissions).push(createdPermission);
|
||||
}
|
||||
this.notifyOthers(note.id);
|
||||
this.notifyOthers(note);
|
||||
return await this.noteRepository.save(note);
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ export class PermissionsService {
|
|||
);
|
||||
(await note.userPermissions).push(noteUserPermission);
|
||||
}
|
||||
this.notifyOthers(note.id);
|
||||
this.notifyOthers(note);
|
||||
return await this.noteRepository.save(note);
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ export class PermissionsService {
|
|||
}
|
||||
}
|
||||
note.userPermissions = Promise.resolve(newPermissions);
|
||||
this.notifyOthers(note.id);
|
||||
this.notifyOthers(note);
|
||||
return await this.noteRepository.save(note);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ export class PermissionsService {
|
|||
);
|
||||
(await note.groupPermissions).push(noteGroupPermission);
|
||||
}
|
||||
this.notifyOthers(note.id);
|
||||
this.notifyOthers(note);
|
||||
return await this.noteRepository.save(note);
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ export class PermissionsService {
|
|||
}
|
||||
}
|
||||
note.groupPermissions = Promise.resolve(newPermissions);
|
||||
this.notifyOthers(note.id);
|
||||
this.notifyOthers(note);
|
||||
return await this.noteRepository.save(note);
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ export class PermissionsService {
|
|||
*/
|
||||
async changeOwner(note: Note, owner: User): Promise<Note> {
|
||||
note.owner = Promise.resolve(owner);
|
||||
this.notifyOthers(note.id);
|
||||
this.notifyOthers(note);
|
||||
return await this.noteRepository.save(note);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue