diff --git a/frontend/src/components/ShareDomain/RoleLabel.vue b/frontend/src/components/ShareDomain/RoleLabel.vue index 7f694de..8e84303 100644 --- a/frontend/src/components/ShareDomain/RoleLabel.vue +++ b/frontend/src/components/ShareDomain/RoleLabel.vue @@ -1,11 +1,15 @@ diff --git a/frontend/src/components/ShareDomain/ShareDomainDialog.vue b/frontend/src/components/ShareDomain/ShareDomainDialog.vue index ee59207..54d4327 100644 --- a/frontend/src/components/ShareDomain/ShareDomainDialog.vue +++ b/frontend/src/components/ShareDomain/ShareDomainDialog.vue @@ -37,7 +37,7 @@ {{scope.opt.fullName}} {{scope.opt.email}} -
+
@@ -47,7 +47,7 @@ @@ -84,6 +84,7 @@ interface Props { domain: IDomainOwnerDisplay; dialogTitle: string; userListTitle: string; + hideSelf: boolean; shareApi: (user: IUserDisplay, domain: IDomainOwnerDisplay) => Promise; removeSharedApi: (user: IUserDisplay, domain: IDomainOwnerDisplay) => Promise; getSharedApi: (domain: IDomainOwnerDisplay) => Promise; @@ -204,20 +205,28 @@ const loadShared = async () => { loading.value = true; sharedUsersIdSet.clear(); + if(props.hideSelf) { + sharedUsersIdSet.add((Number)(authStore.userId)); + } + const { data } = await props.getSharedApi(props.domain); - sharedUsers.value = data.data.map((item: IUser) => { + + sharedUsers.value = data.data.reduce((arr: IUserDisplayWithShareRole[], item: IUser) => { const val = itemToDisplay(item); - sharedUsersIdSet.add(val.id); - // for sort - if (isOwner(item.id)) { - val.role = 2; - } else if (isManager(item.id)) { - val.role = 1; - } else { - val.role = 0; + if(!sharedUsersIdSet.has(val.id)) { + sharedUsersIdSet.add(val.id); + // for sort + if (isOwner(val.id)) { + val.role = 2; + } else if (isManager(val.id)) { + val.role = 1; + } else { + val.role = 0; + } + arr.push(val); } - return val; - }).reverse().sort((a: IUserDisplayWithShareRole, b: IUserDisplayWithShareRole) => b.role - a.role); + return arr; + }, []).sort((a: IUserDisplayWithShareRole, b: IUserDisplayWithShareRole) => b.role - a.role); canSharedUsers.value = allUsers.value.filter((item) => !sharedUsersIdSet.has(item.id)); canSharedUserFilteredOptions.value = canSharedUsers.value; diff --git a/frontend/src/components/ShareDomain/ShareManageDialog.vue b/frontend/src/components/ShareDomain/ShareManageDialog.vue index 8455ec7..b2a7045 100644 --- a/frontend/src/components/ShareDomain/ShareManageDialog.vue +++ b/frontend/src/components/ShareDomain/ShareManageDialog.vue @@ -7,6 +7,7 @@ :remove-shared-api="removeSharedApi" :get-shared-api="getSharedApi" :model-value="modelValue" + hide-self @update:modelValue="updateModelValue" @close="close" />