You've already forked AstralRinth
forked from didirus/AstralRinth
fix: instance project author link not checking for organizations (#3315)
Co-authored-by: Emma Alexia <emma@modrinth.com>
This commit is contained in:
@@ -66,10 +66,10 @@
|
|||||||
|
|
||||||
if (x.author) {
|
if (x.author) {
|
||||||
item.creator = {
|
item.creator = {
|
||||||
name: x.author,
|
name: x.author.name,
|
||||||
type: 'user',
|
type: x.author.type,
|
||||||
id: x.author,
|
id: x.author.slug,
|
||||||
link: 'https://modrinth.com/user/' + x.author,
|
link: `https://modrinth.com/${x.author.type}/${x.author.slug}`,
|
||||||
linkProps: { target: '_blank' },
|
linkProps: { target: '_blank' },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,6 +329,28 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
type ProjectListEntryAuthor = {
|
||||||
|
name: string
|
||||||
|
slug: string
|
||||||
|
type: 'user' | 'organization'
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProjectListEntry = {
|
||||||
|
path: string
|
||||||
|
name: string
|
||||||
|
slug?: string
|
||||||
|
author: ProjectListEntryAuthor | null
|
||||||
|
version: string | null
|
||||||
|
file_name: string
|
||||||
|
icon: string | null
|
||||||
|
disabled: boolean
|
||||||
|
updateVersion?: string
|
||||||
|
outdated: boolean
|
||||||
|
updated: dayjs.Dayjs
|
||||||
|
project_type: string
|
||||||
|
id?: string
|
||||||
|
}
|
||||||
|
|
||||||
const isPackLocked = computed(() => {
|
const isPackLocked = computed(() => {
|
||||||
return props.instance.linked_data && props.instance.linked_data.locked
|
return props.instance.linked_data && props.instance.linked_data.locked
|
||||||
})
|
})
|
||||||
@@ -338,7 +360,7 @@ const canUpdatePack = computed(() => {
|
|||||||
})
|
})
|
||||||
const exportModal = ref(null)
|
const exportModal = ref(null)
|
||||||
|
|
||||||
const projects = ref([])
|
const projects = ref<ProjectListEntry[]>([])
|
||||||
const selectedFiles = ref([])
|
const selectedFiles = ref([])
|
||||||
const selectedProjects = computed(() =>
|
const selectedProjects = computed(() =>
|
||||||
projects.value.filter((x) => selectedFiles.value.includes(x.file_name)),
|
projects.value.filter((x) => selectedFiles.value.includes(x.file_name)),
|
||||||
@@ -347,7 +369,7 @@ const selectedProjects = computed(() =>
|
|||||||
const selectionMap = ref(new Map())
|
const selectionMap = ref(new Map())
|
||||||
|
|
||||||
const initProjects = async (cacheBehaviour?) => {
|
const initProjects = async (cacheBehaviour?) => {
|
||||||
const newProjects = []
|
const newProjects: ProjectListEntry[] = []
|
||||||
|
|
||||||
const profileProjects = await get_projects(props.instance.path, cacheBehaviour)
|
const profileProjects = await get_projects(props.instance.path, cacheBehaviour)
|
||||||
const fetchProjects = []
|
const fetchProjects = []
|
||||||
@@ -384,21 +406,29 @@ const initProjects = async (cacheBehaviour?) => {
|
|||||||
|
|
||||||
const team = modrinthTeams.find((x) => x[0].team_id === project.team)
|
const team = modrinthTeams.find((x) => x[0].team_id === project.team)
|
||||||
|
|
||||||
let owner
|
let author: ProjectListEntryAuthor | null
|
||||||
|
|
||||||
if (org) {
|
if (org) {
|
||||||
owner = org.name
|
author = {
|
||||||
|
name: org.name,
|
||||||
|
slug: org.slug,
|
||||||
|
type: 'organization',
|
||||||
|
}
|
||||||
} else if (team) {
|
} else if (team) {
|
||||||
owner = team.find((x) => x.is_owner).user.username
|
const teamMember = team.find((x) => x.is_owner)
|
||||||
|
author = {
|
||||||
|
name: teamMember.user.username,
|
||||||
|
slug: teamMember.user.username,
|
||||||
|
type: 'user',
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
owner = null
|
author = null
|
||||||
}
|
}
|
||||||
|
|
||||||
newProjects.push({
|
newProjects.push({
|
||||||
path,
|
path,
|
||||||
name: project.title,
|
name: project.title,
|
||||||
slug: project.slug,
|
slug: project.slug,
|
||||||
author: owner,
|
author,
|
||||||
version: version.version_number,
|
version: version.version_number,
|
||||||
file_name: file.file_name,
|
file_name: file.file_name,
|
||||||
icon: project.icon_url,
|
icon: project.icon_url,
|
||||||
@@ -417,7 +447,7 @@ const initProjects = async (cacheBehaviour?) => {
|
|||||||
newProjects.push({
|
newProjects.push({
|
||||||
path,
|
path,
|
||||||
name: file.file_name.replace('.disabled', ''),
|
name: file.file_name.replace('.disabled', ''),
|
||||||
author: '',
|
author: null,
|
||||||
version: null,
|
version: null,
|
||||||
file_name: file.file_name,
|
file_name: file.file_name,
|
||||||
icon: null,
|
icon: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user