diff --git a/src/application/i18n/messages/en.json b/src/application/i18n/messages/en.json index aed70cd6..78538e17 100644 --- a/src/application/i18n/messages/en.json +++ b/src/application/i18n/messages/en.json @@ -67,6 +67,11 @@ "roles": { "Read": "Reader", "Write": "Writer" + }, + "removeMemberConfirmationTitle": "Remove member", + "removeMemberConfirmationBody": "Are you sure you want to remove user from the team?", + "ContextMenu": { + "remove": "Remove" } } }, diff --git a/src/application/services/useNoteSettings.ts b/src/application/services/useNoteSettings.ts index 7e2d38a3..9613b0dd 100644 --- a/src/application/services/useNoteSettings.ts +++ b/src/application/services/useNoteSettings.ts @@ -66,6 +66,13 @@ interface UseNoteSettingsComposableState { * @param newParentURL - New parent note URL */ setParent: (id: NoteId, newParentURL: string) => Promise; + + /** + * Delete team member by user id + * @param id - Note id + * @param userId - User id + */ + removeMemberByUserId: (id: NoteId, userId: UserId) => Promise; } /** @@ -188,6 +195,15 @@ export default function (): UseNoteSettingsComposableState { } }; + /** + * Delete team member by user id + * @param id - Note id + * @param userId - User id + */ + const removeMemberByUserId = async (id: NoteId, userId: UserId): Promise => { + await noteSettingsService.removeMemberByUserId(id, userId); + }; + return { updateCover, setParent, @@ -198,5 +214,6 @@ export default function (): UseNoteSettingsComposableState { revokeHash, changeRole, deleteNoteById, + removeMemberByUserId, }; } diff --git a/src/domain/noteSettings.repository.interface.ts b/src/domain/noteSettings.repository.interface.ts index ce2d8a1e..856bd512 100644 --- a/src/domain/noteSettings.repository.interface.ts +++ b/src/domain/noteSettings.repository.interface.ts @@ -43,4 +43,11 @@ export default interface NoteSettingsRepositoryInterface { * @param id - Note id */ deleteNote(id: NoteId): Promise; + + /** + * Delete team member by user id + * @param id - Note id + * @param userId - User id + */ + removeMemberByUserId(id: NoteId, userId: UserId): Promise; } diff --git a/src/domain/noteSettings.service.ts b/src/domain/noteSettings.service.ts index 26ca425d..1037a7d1 100644 --- a/src/domain/noteSettings.service.ts +++ b/src/domain/noteSettings.service.ts @@ -118,4 +118,13 @@ export default class NoteSettingsService { public async deleteNote(id: NoteId): Promise { return await this.noteSettingsRepository.deleteNote(id); } + + /** + * Delete team member by user id + * @param id - Note id + * @param userId - User id + */ + public async removeMemberByUserId(id: NoteId, userId: UserId): Promise { + return await this.noteSettingsRepository.removeMemberByUserId(id, userId); + } } diff --git a/src/infrastructure/noteSettings.repository.ts b/src/infrastructure/noteSettings.repository.ts index 90efebe2..3112f28f 100644 --- a/src/infrastructure/noteSettings.repository.ts +++ b/src/infrastructure/noteSettings.repository.ts @@ -69,4 +69,15 @@ export default class NoteSettingsRepository implements NoteSettingsRepositoryInt public async deleteNote(id: NoteId): Promise { await this.transport.delete(`/note/` + id); } + + /** + * Delete team member by user id + * @param id - Note id + * @param userId - User id + */ + public async removeMemberByUserId(id: NoteId, userId: UserId): Promise { + const data = { userId }; + + await this.transport.delete(`/note-settings/${id}/team`, data); + } } diff --git a/src/presentation/components/team/MoreActions.vue b/src/presentation/components/team/MoreActions.vue new file mode 100644 index 00000000..74d4669d --- /dev/null +++ b/src/presentation/components/team/MoreActions.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/src/presentation/components/team/Team.vue b/src/presentation/components/team/Team.vue index b02e5817..bcfcf2bb 100644 --- a/src/presentation/components/team/Team.vue +++ b/src/presentation/components/team/Team.vue @@ -15,6 +15,11 @@ :note-id="noteId" :team-member="member" /> +