Fixing an issue with loading the user page, as per issue documented in #14890.

This commit is contained in:
mike12345567 2024-10-29 12:15:50 +00:00
parent 5cad630b25
commit d342b2248e
2 changed files with 19 additions and 13 deletions

View File

@ -71,7 +71,6 @@
]
let userData = []
let invitesLoaded = false
let tenantOwnerLoaded = false
let pendingInvites = []
let parsedInvites = []
@ -100,13 +99,9 @@
$: pendingSchema = getPendingSchema(schema)
$: userData = []
$: inviteUsersResponse = { successful: [], unsuccessful: [] }
$: setEnrichedUsers($fetch.rows, tenantOwnerLoaded)
$: setEnrichedUsers($fetch.rows, tenantOwner)
const setEnrichedUsers = async rows => {
if (!tenantOwnerLoaded) {
enrichedUsers = []
return
}
const setEnrichedUsers = async (rows, owner) => {
enrichedUsers = rows?.map(user => {
let userGroups = []
$groups.forEach(group => {
@ -118,7 +113,9 @@
})
}
})
user.tenantOwnerEmail = tenantOwner?.email
if (owner) {
user.tenantOwnerEmail = owner.email
}
const role = Constants.ExtendedBudibaseRoleOptions.find(
x => x.value === users.getUserRole(user)
)
@ -322,13 +319,22 @@
try {
await groups.actions.init()
groupsLoaded = true
pendingInvites = await users.getInvites()
invitesLoaded = true
tenantOwner = await users.getAccountHolder()
tenantOwnerLoaded = true
} catch (error) {
notifications.error("Error fetching user group data")
}
try {
pendingInvites = await users.getInvites()
invitesLoaded = true
} catch (err) {
notifications.error("Error fetching user invitations")
}
try {
tenantOwner = await users.getAccountHolder()
} catch (err) {
if (err.status !== 404) {
notifications.error("Error fetching account holder")
}
}
})
</script>

View File

@ -32,7 +32,7 @@ export default class UserFetch extends DataFetch {
const { cursor, query } = get(this.store)
let finalQuery
// convert old format to new one - we now allow use of the lucene format
const { appId, paginated, ...rest } = query
const { appId, paginated, ...rest } = query || {}
if (!QueryUtils.hasFilters(query) && rest.email != null) {
finalQuery = { string: { email: rest.email } }
} else {