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) 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 ( if (
donationLinks !== this.project.donation_urls && donationLinks !== this.project.donation_urls &&
!( !(

View File

@ -53,9 +53,21 @@
</div> </div>
<div class="mobile-row"> <div class="mobile-row">
by by
<nuxt-link :to="`/user/${project.owner.username}`" class="iconified-link"> <nuxt-link
<Avatar :src="project.owner.avatar_url" circle size="xxs" raised /> v-if="project.owner"
<span>{{ project.owner.username }}</span> :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> </nuxt-link>
</div> </div>
<div class="mobile-row"> <div class="mobile-row">
@ -144,9 +156,12 @@ const projectTypes = computed(() => {
if (projects.value) { if (projects.value) {
const teamIds = projects.value.map((x) => x.team) 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 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: result } = await useAsyncData(url, () => useBaseFetch(url))
const { data: orgs } = await useAsyncData(orgUrl, () => useBaseFetch(orgUrl, { apiVersion: 3 }))
if (result.value) { if (result.value) {
members.value = result.value members.value = result.value
@ -154,7 +169,8 @@ if (projects.value) {
projects.value = projects.value.map((project) => { projects.value = projects.value.map((project) => {
project.owner = members.value project.owner = members.value
.flat() .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 = project.queued ? now - app.$dayjs(project.queued) : Number.MAX_VALUE
project.age_warning = '' project.age_warning = ''
if (project.age > TIME_24H * 2) { if (project.age > TIME_24H * 2) {

View File

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

View File

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