aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src/composables/useGroupsNavigation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/src/composables/useGroupsNavigation.ts')
-rw-r--r--apps/settings/src/composables/useGroupsNavigation.ts21
1 files changed, 14 insertions, 7 deletions
diff --git a/apps/settings/src/composables/useGroupsNavigation.ts b/apps/settings/src/composables/useGroupsNavigation.ts
index 835664fbdc1..d9f0637843b 100644
--- a/apps/settings/src/composables/useGroupsNavigation.ts
+++ b/apps/settings/src/composables/useGroupsNavigation.ts
@@ -1,3 +1,7 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import type { ComputedRef, Ref } from 'vue'
import type { IGroup } from '../views/user-types'
@@ -13,14 +17,12 @@ function formatGroupMenu(group?: IGroup) {
return null
}
- const item = {
+ return {
id: group.id,
title: group.name,
- usercount: group.usercount,
- count: Math.max(0, group.usercount - group.disabled),
+ usercount: group.usercount ?? 0,
+ count: Math.max(0, (group.usercount ?? 0) - (group.disabled ?? 0)),
}
-
- return item
}
export const useFormatGroups = (groups: Ref<IGroup[]>|ComputedRef<IGroup[]>) => {
@@ -30,7 +32,7 @@ export const useFormatGroups = (groups: Ref<IGroup[]>|ComputedRef<IGroup[]>) =>
const userGroups = computed(() => {
const formatted = groups.value
// filter out disabled and admin
- .filter(group => group.id !== 'disabled' && group.id !== 'admin')
+ .filter(group => group.id !== 'disabled' && group.id !== '__nc_internal_recent' && group.id !== 'admin')
// format group
.map(group => formatGroupMenu(group))
// remove invalid
@@ -48,5 +50,10 @@ export const useFormatGroups = (groups: Ref<IGroup[]>|ComputedRef<IGroup[]>) =>
*/
const disabledGroup = computed(() => formatGroupMenu(groups.value.find(group => group.id === 'disabled')))
- return { adminGroup, disabledGroup, userGroups }
+ /**
+ * The group of recent users
+ */
+ const recentGroup = computed(() => formatGroupMenu(groups.value.find(group => group.id === '__nc_internal_recent')))
+
+ return { adminGroup, recentGroup, disabledGroup, userGroups }
}