fix: don't create user permissions for owner

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-05-04 17:50:21 +02:00
parent 825b3b72ff
commit e02221acd2
2 changed files with 10 additions and 0 deletions

View file

@ -1015,6 +1015,13 @@ describe('PermissionsService', () => {
expect(eventEmitterEmitSpy).toHaveBeenCalled();
});
describe('works', () => {
it('with user not added if owner', async () => {
const user = User.create('test', 'Testy') as User;
const note = Note.create(user) as Note;
const resultNote = await service.setUserPermission(note, user, true);
expect(await resultNote.userPermissions).toHaveLength(0);
});
it('with user not added before and editable', async () => {
const note = Note.create(null) as Note;
const user = User.create('test', 'Testy') as User;