Skip to content

Commit ff9405c

Browse files
authored
split project visibility and review status (attempt 2) (#8393)
* split project status into visibility/in review/outcome * fix up * add in_review history * prepr * undo frontend * fix in_review on delete * fix requested status in frontend * rename listed -> public * fix frontend thing * remove some redundant logic * proper history provenance * comment out the migrations which drop data * style fix * fix ci * fix ci * fix tests
1 parent e3a4e5c commit ff9405c

98 files changed

Lines changed: 3409 additions & 1851 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/frontend/src/components/ui/moderation/ModerationQueueCard.vue‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,17 @@
3737
</span>
3838
</div>
3939
<div
40-
v-if="queueEntry.project.requested_status"
4140
class="flex items-center gap-2 rounded-full border border-solid border-surface-5 bg-surface-4 px-2.5 py-1"
4241
>
4342
<span class="text-sm text-secondary">Requesting</span>
44-
<Badge :type="queueEntry.project.requested_status" class="text-sm" />
43+
<Badge
44+
:type="
45+
queueEntry.project.visibility === 'public'
46+
? 'approved'
47+
: queueEntry.project.visibility
48+
"
49+
class="text-sm"
50+
/>
4551
</div>
4652
<div
4753
v-if="showExternalDependencies"
@@ -106,7 +112,8 @@
106112
v-tooltip="`First submitted ${formatDateTimeFull(initialQueuedDate.toDate())}`"
107113
class="text-sm text-secondary"
108114
>
109-
First submitted {{ formatRelativeTime(initialQueuedDate.toISOString()) }}
115+
First submitted
116+
{{ formatRelativeTime(initialQueuedDate.toISOString()) }}
110117
</span>
111118
</div>
112119

‎apps/frontend/src/components/ui/thread/ConversationThread.vue‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,8 @@ const replyMutation = useMutation({
872872
const assertCurrent = () => {
873873
if (props.thread.id !== threadId) throw new Error(formatMessage(messages.changedThread))
874874
}
875-
if (replyBody.value.trim()) {
875+
const reviewReason = replyBody.value.trim() || undefined
876+
if (reviewReason) {
876877
const reply = {
877878
threadId,
878879
body: replyBody.value,
@@ -910,7 +911,7 @@ const replyMutation = useMutation({
910911
queryKey: ['project', projectId, 'validation'],
911912
})
912913
assertCurrent()
913-
if (status !== null) return (await props.setStatus(status)) !== false
914+
if (status !== null) return (await props.setStatus(status, reviewReason)) !== false
914915
return true
915916
},
916917
onError: (error) =>

‎apps/frontend/src/pages/[type]/[project]/moderation.vue‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ function updateThread(newThread: Labrinth.Threads.v3.Thread | null | undefined)
528528
)
529529
}
530530
531-
async function setStatus(status: Labrinth.Projects.v2.ProjectStatus) {
531+
async function setStatus(status: Labrinth.Projects.v2.ProjectStatus, reviewReason?: string) {
532532
if (status === 'processing') {
533533
return await setProcessing()
534534
}
@@ -541,7 +541,11 @@ async function setStatus(status: Labrinth.Projects.v2.ProjectStatus) {
541541
await verifyThreadIssuesForApproval(threadId, client, () => {
542542
if (project.value.id !== projectId) throw new Error(formatMessage(messages.projectChanged))
543543
})
544-
await client.labrinth.projects_v3.edit(projectId, { status })
544+
545+
await client.labrinth.projects_v3.edit(projectId, {
546+
status,
547+
review_reason: reviewReason,
548+
})
545549
await invalidate()
546550
await queryClient.invalidateQueries({ queryKey: ['thread', threadId] })
547551
return true

‎apps/frontend/src/providers/project-review/review-decision.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export async function applyReviewDecision(
5252
} else if (decision.status) {
5353
await client.labrinth.projects_v3.edit(decision.projectId, {
5454
status: decision.status,
55+
review_reason: decision.body.trim() || undefined,
5556
})
5657
}
5758
assertCurrent()

‎apps/labrinth/.sqlx/query-04dbb91ad93de31a6eab62f712743dc3b3e4c93605769fd7d653beff95bf46e0.json‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

apps/labrinth/.sqlx/query-20ebdaf894827f6084af18aedab2f6ce511a659c11e348f30afeb43007a90ee2.json renamed to apps/labrinth/.sqlx/query-08c89420b7bb31235ce5fccf3f77cbaf79db836565767ef2bf13a8890c144475.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/labrinth/.sqlx/query-09b53be246c239325abee5bfa297c403aade9dd1dcd79f71ec6d7ba193bbbf3b.json‎

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/.sqlx/query-59b6eea93ce248d2b1eaf14fe8970bba8ccd2df0995a21bdb34ae3214cef6377.json renamed to apps/labrinth/.sqlx/query-18b4f9a39f59df78a937cff897a7ffce2080bc6910b76d0c91dfeb12d73a0207.json

Lines changed: 35 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)