Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Commit

Permalink
Fix missing categories and environments on orgs and following collect…
Browse files Browse the repository at this point in the history
…ion (#1667)
  • Loading branch information
Prospector authored Apr 9, 2024
1 parent 4c25658 commit 5f85af7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
14 changes: 12 additions & 2 deletions pages/collection/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,18 @@ try {
updated: auth.value.user.created,
})
;[{ data: projects, refresh: refreshProjects }] = await Promise.all([
useAsyncData(`user/${auth.value.user.id}/follows`, () =>
useBaseFetch(`user/${auth.value.user.id}/follows`)
useAsyncData(
`user/${auth.value.user.id}/follows`,
() => useBaseFetch(`user/${auth.value.user.id}/follows`),
{
transform: (projects) => {
for (const project of projects) {
project.categories = project.categories.concat(project.loaders)
}
return projects
},
}
),
])
creator = ref(auth.value.user)
Expand Down
28 changes: 27 additions & 1 deletion pages/organization/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,14 @@
:follows="project.followers.toString()"
:icon-url="project.icon_url"
:categories="project.categories"
:client-side="project.client_side"
:server-side="project.server_side"
:status="
auth.user && (auth.user.id === user.id || tags.staffRoles.includes(auth.user.role))
? project.status
: null
"
:type="project.project_type"
:type="project.project_types[0] ?? 'project'"
:color="project.color"
/>
</div>
Expand Down Expand Up @@ -271,6 +273,30 @@ const [
transform: (projects) => {
for (const project of projects) {
project.categories = project.categories.concat(project.loaders)
if (project.mrpack_loaders) {
project.categories = project.categories.concat(project.mrpack_loaders)
}
const singleplayer = project.singleplayer && project.singleplayer[0]
const clientAndServer = project.client_and_server && project.client_and_server[0]
const clientOnly = project.client_only && project.client_only[0]
const serverOnly = project.server_only && project.server_only[0]
// quick and dirty hack to show envs as legacy
if (singleplayer && clientAndServer && !clientOnly && !serverOnly) {
project.client_side = 'required'
project.server_side = 'required'
} else if (singleplayer && clientAndServer && clientOnly && !serverOnly) {
project.client_side = 'required'
project.server_side = 'unsupported'
} else if (singleplayer && clientAndServer && !clientOnly && serverOnly) {
project.client_side = 'unsupported'
project.server_side = 'required'
} else if (singleplayer && clientAndServer && clientOnly && serverOnly) {
project.client_side = 'optional'
project.server_side = 'optional'
}
}
return projects
Expand Down

0 comments on commit 5f85af7

Please sign in to comment.