Fix moderation + oauth (#1515)

This commit is contained in:
Geometrically 2024-01-07 00:17:22 -05:00 committed by GitHub
parent 82e9ad8a20
commit 1fa556cd00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 14 deletions

View File

@ -199,11 +199,6 @@ export default defineNuxtComponent({
}
const donationLinks = this.donationLinks.filter((link) => link.url && link.platform)
donationLinks.forEach((link) => {
link.id = this.tags.donationPlatforms.find(
(platform) => platform.name === link.platform
).short
})
if (
donationLinks !== this.project.donation_urls &&
!(

View File

@ -53,9 +53,21 @@
</div>
<div class="mobile-row">
by
<nuxt-link :to="`/user/${project.owner.username}`" class="iconified-link">
<Avatar :src="project.owner.avatar_url" circle size="xxs" raised />
<span>{{ project.owner.username }}</span>
<nuxt-link
v-if="project.owner"
:to="`/user/${project.owner.user.username}`"
class="iconified-link"
>
<Avatar :src="project.owner.user.avatar_url" circle size="xxs" raised />
<span>{{ project.owner.user.username }}</span>
</nuxt-link>
<nuxt-link
v-else-if="project.org"
:to="`/organization/${project.org.slug}`"
class="iconified-link"
>
<Avatar :src="project.org.icon_url" circle size="xxs" raised />
<span>{{ project.org.name }}</span>
</nuxt-link>
</div>
<div class="mobile-row">
@ -144,9 +156,12 @@ const projectTypes = computed(() => {
if (projects.value) {
const teamIds = projects.value.map((x) => x.team)
const organizationIds = projects.value.filter((x) => x.organization).map((x) => x.organization)
const url = `teams?ids=${encodeURIComponent(JSON.stringify(teamIds))}`
const orgUrl = `organizations?ids=${encodeURIComponent(JSON.stringify(organizationIds))}`
const { data: result } = await useAsyncData(url, () => useBaseFetch(url))
const { data: orgs } = await useAsyncData(orgUrl, () => useBaseFetch(orgUrl, { apiVersion: 3 }))
if (result.value) {
members.value = result.value
@ -154,7 +169,8 @@ if (projects.value) {
projects.value = projects.value.map((project) => {
project.owner = members.value
.flat()
.find((x) => x.team_id === project.team && x.role === 'Owner').user
.find((x) => x.team_id === project.team && x.role === 'Owner')
project.org = orgs.value.find((x) => x.id === project.organization)
project.age = project.queued ? now - app.$dayjs(project.queued) : Number.MAX_VALUE
project.age_warning = ''
if (project.age > TIME_24H * 2) {

View File

@ -10,7 +10,7 @@
</p>
</div>
<ChartDisplay :projects="projects" />
<ChartDisplay :projects="projects.map((x) => ({ title: x.name, ...x }))" />
</div>
</template>

View File

@ -323,7 +323,7 @@ async function onImageSelection(files) {
await useBaseFetch('oauth/app/' + editingId.value + '/icon', {
method: 'PATCH',
apiVersion: 3,
internal: true,
body: file,
query: {
ext: extFromType,
@ -352,7 +352,7 @@ async function createApp() {
try {
const createdAppInfo = await useBaseFetch('oauth/app', {
method: 'POST',
apiVersion: 3,
internal: true,
body: {
name: name.value,
icon_url: icon.value,
@ -427,7 +427,7 @@ async function editApp() {
await useBaseFetch('oauth/app/' + editingId.value, {
method: 'PATCH',
apiVersion: 3,
internal: true,
body,
})
@ -455,7 +455,7 @@ async function removeApp() {
throw new Error('No editing id')
}
await useBaseFetch(`oauth/app/${editingId.value}`, {
apiVersion: 3,
internal: true,
method: 'DELETE',
})
await refresh()