Miscellaneous fixes relating to statuses, et al (#920)

This commit is contained in:
triphora
2023-01-21 16:02:11 -05:00
committed by GitHub
parent d68bbbf9a1
commit 544aba53dc
10 changed files with 101 additions and 136 deletions

View File

@@ -17,5 +17,6 @@ module.exports = {
rules: { rules: {
'no-console': 'off', 'no-console': 'off',
'vue/no-v-html': 'off', 'vue/no-v-html': 'off',
'import/no-named-as-default': 'off',
}, },
} }

View File

@@ -10,6 +10,12 @@
<nuxt-link to="/legal/rules">Rules</nuxt-link>. Rest assured, well <nuxt-link to="/legal/rules">Rules</nuxt-link>. Rest assured, well
keep your identifying information private. keep your identifying information private.
</p> </p>
<p v-if="itemType === 'project' || itemType === 'version'">
Please <strong>do not</strong> use this to report bugs with the
project itself. This form is only for submitting a report to Modrinth
staff. If the project has an Issues link or a Discord invite, consider
reporting it there.
</p>
</div> </div>
<label class="report-label" for="report-type"> <label class="report-label" for="report-type">
<span> <span>

View File

@@ -4,7 +4,8 @@
$auth.user && $auth.user &&
currentMember && currentMember &&
nags.filter((x) => x.condition).length > 0 && nags.filter((x) => x.condition).length > 0 &&
project.status === 'draft' (project.status === 'draft' ||
$tag.rejectedStatuses.includes(project.status))
" "
class="author-actions universal-card" class="author-actions universal-card"
> >
@@ -63,6 +64,16 @@
/>{{ nag.title }}</span />{{ nag.title }}</span
> >
{{ nag.description }} {{ nag.description }}
<Checkbox
v-if="
nag.status === 'review' &&
project.moderator_message &&
$tag.rejectedStatuses.includes(project.status)
"
v-model="acknowledgedMessage"
>
I acknowledge that I have addressed the staff's message on the sidebar
</Checkbox>
<NuxtLink <NuxtLink
v-if="nag.link" v-if="nag.link"
:class="{ invisible: nag.link.hide }" :class="{ invisible: nag.link.hide }"
@@ -99,10 +110,12 @@ import RequiredIcon from '~/assets/images/utils/asterisk.svg?inline'
import SuggestionIcon from '~/assets/images/utils/lightbulb.svg?inline' import SuggestionIcon from '~/assets/images/utils/lightbulb.svg?inline'
import ModerationIcon from '~/assets/images/sidebar/admin.svg?inline' import ModerationIcon from '~/assets/images/sidebar/admin.svg?inline'
import SendIcon from '~/assets/images/utils/send.svg?inline' import SendIcon from '~/assets/images/utils/send.svg?inline'
import Checkbox from '~/components/ui/Checkbox'
export default { export default {
name: 'ProjectPublishingChecklist', name: 'ProjectPublishingChecklist',
components: { components: {
Checkbox,
ChevronRightIcon, ChevronRightIcon,
DropdownIcon, DropdownIcon,
CheckIcon, CheckIcon,
@@ -163,6 +176,11 @@ export default {
}, },
}, },
}, },
data() {
return {
acknowledgedMessage: !this.project.moderator_message,
}
},
computed: { computed: {
featuredGalleryImage() { featuredGalleryImage() {
return this.project.gallery.find((img) => img.featured) return this.project.gallery.find((img) => img.featured)
@@ -290,7 +308,8 @@ export default {
}, },
}, },
{ {
condition: this.project.status === 'draft', hide: this.project.status !== 'draft',
condition: true,
title: 'Submit for review', title: 'Submit for review',
id: 'submit-for-review', id: 'submit-for-review',
description: description:
@@ -305,6 +324,25 @@ export default {
.length > 0, .length > 0,
}, },
}, },
{
hide: !this.$tag.rejectedStatuses.includes(this.project.status),
condition: true,
title: 'Resubmit for review',
id: 'resubmit-for-review',
description: `Your project has been ${this.project.status} by
Modrinth's staff. In most cases, you can resubmit for review after
addressing the staff's message.`,
status: 'review',
link: null,
action: {
onClick: this.submitForReview,
title: 'Resubmit for review',
disabled: () =>
!this.acknowledgedMessage ||
this.nags.filter((x) => x.condition && x.status === 'required')
.length > 0,
},
},
] ]
.filter((x) => !x.hide) .filter((x) => !x.hide)
.sort((a, b) => .sort((a, b) =>
@@ -341,6 +379,7 @@ export default {
}, },
async submitForReview() { async submitForReview() {
if ( if (
!this.acknowledgedMessage ||
this.nags.filter((x) => x.condition && x.status === 'required') this.nags.filter((x) => x.condition && x.status === 'required')
.length === 0 .length === 0
) { ) {

View File

@@ -132,10 +132,7 @@
<span class="title">Settings</span> <span class="title">Settings</span>
</NuxtLink> </NuxtLink>
<NuxtLink <NuxtLink
v-if=" v-if="$tag.staffRoles.includes($auth.user.role)"
$auth.user.role === 'moderator' ||
$auth.user.role === 'admin'
"
class="item button-transparent" class="item button-transparent"
to="/moderation" to="/moderation"
> >
@@ -297,10 +294,7 @@
<span class="dropdown-item__text">Settings</span> <span class="dropdown-item__text">Settings</span>
</NuxtLink> </NuxtLink>
<NuxtLink <NuxtLink
v-if=" v-if="$auth.user && $tag.staffRoles.includes($auth.user.role)"
$auth.user &&
($auth.user.role === 'moderator' || $auth.user.role === 'admin')
"
class="iconified-button raised-button" class="iconified-button raised-button"
to="/moderation" to="/moderation"
> >

View File

@@ -2,7 +2,7 @@
<div class="main"> <div class="main">
<div class="error"> <div class="error">
<Logo404 v-if="error.statusCode === 404" /> <Logo404 v-if="error.statusCode === 404" />
<h1 v-else>An error occured!</h1> <h1 v-else>An error occurred!</h1>
<p>{{ error.message }}</p> <p>{{ error.message }}</p>
<div class="button-group"> <div class="button-group">
<nuxt-link to="/" class="iconified-button raised-button brand-button"> <nuxt-link to="/" class="iconified-button raised-button brand-button">

View File

@@ -278,96 +278,44 @@
</div> </div>
</div> </div>
<div <div
v-if=" v-if="currentMember && project.moderator_message"
currentMember &&
((!$tag.approvedStatuses.includes(project.status) &&
project.status !== 'processing') ||
(project.moderator_message &&
(project.moderator_message.message ||
project.moderator_message.body)))
"
class="universal-card" class="universal-card"
> >
<h3 class="card-header">Moderation status</h3> <h3 class="card-header">Message from the moderators:</h3>
<div class="current-status"> <div v-if="project.moderator_message.body">
Project status: <p
<Badge :type="project.status" /> v-if="project.moderator_message.message"
</div> class="mod-message__title"
<div class="message"> >
<p v-if="project.status === 'rejected'"> {{ project.moderator_message.message }}
Your project has been rejected by Modrinth's staff. In most cases,
you can resubmit for review after addressing the staff's message,
which is below. Do not resubmit until you've addressed the message
from the moderators!
</p> </p>
<div v-if="project.moderator_message">
<hr class="card-divider" />
<div v-if="project.moderator_message.body">
<h3 class="card-header">Message from the moderators:</h3>
<p
v-if="project.moderator_message.message"
class="mod-message__title"
>
{{ project.moderator_message.message }}
</p>
<div
v-highlightjs
class="markdown-body"
v-html="$xss($md.render(project.moderator_message.body))"
/>
</div>
<div v-else>
<h3 class="card-header">Message from the moderators:</h3>
<p>{{ project.moderator_message.message }}</p>
</div>
</div>
</div>
<div class="buttons status-buttons">
<button
v-if="
!$tag.approvedStatuses.includes(project.status) &&
project.status !== 'processing'
"
class="iconified-button brand-button"
@click="submitForReview"
>
<CheckIcon />
Resubmit for review
</button>
<button
v-if="$tag.approvedStatuses.includes(project.status)"
class="iconified-button"
@click="clearMessage"
>
<ClearIcon />
Clear message
</button>
</div>
<div v-if="showKnownErrors" class="known-errors">
<ul>
<li v-if="project.body === ''">
Your project must have a body to submit for review.
</li>
<li v-if="project.versions.length < 1">
Your project must have at least one version to submit for
review.
</li>
<li
v-if="
project.client_side === 'unknown' ||
project.server_side === 'unknown'
"
>
Your project must have the supported environments selected.
</li>
</ul>
</div> </div>
<div
v-highlightjs
class="markdown-body"
v-html="
$xss(
$md.render(
project.moderator_message.body
? project.moderator_message.body
: project.moderator_message.message
)
)
"
/>
</div>
<div class="buttons status-buttons">
<button
v-if="$tag.approvedStatuses.includes(project.status)"
class="iconified-button"
@click="clearMessage"
>
<ClearIcon />
Clear message
</button>
</div> </div>
<div <div
v-if=" v-if="$auth.user && $tag.staffRoles.includes($auth.user.role)"
$auth.user &&
($auth.user.role === 'admin' || $auth.user.role === 'moderator')
"
class="universal-card moderation-card" class="universal-card moderation-card"
> >
<h3>Moderation actions</h3> <h3>Moderation actions</h3>
@@ -378,16 +326,11 @@
project.status === 'processing' project.status === 'processing'
" "
class="iconified-button brand-button" class="iconified-button brand-button"
@click=" @click="openModerationModal(requestedStatus)"
openModerationModal(
project.requested_status
? project.requested_status
: 'approved'
)
"
> >
<CheckIcon /> <CheckIcon />
Approve Approve
{{ requestedStatus !== 'approved' ? `(${requestedStatus})` : '' }}
</button> </button>
<button <button
v-if=" v-if="
@@ -700,9 +643,8 @@
class="card warning" class="card warning"
aria-label="Warning" aria-label="Warning"
> >
{{ project.title }} has been archived by the project author. {{ project.title }} has been archived and will not receive any further
{{ project.title }} will not receive any further updates unless the updates unless the author decides to unarchive the project.
author decides to unarchive the project.
</div> </div>
<div <div
v-if="project.project_type === 'modpack'" v-if="project.project_type === 'modpack'"
@@ -976,8 +918,7 @@ export default {
if ( if (
!currentMember && !currentMember &&
data.$auth.user && data.$auth.user &&
(data.$auth.user.role === 'admin' || data.$tag.staffRoles.includes(data.$auth.user.role)
data.$auth.user.role === 'moderator')
) { ) {
currentMember = { currentMember = {
team_id: project.team_id, team_id: project.team_id,
@@ -1024,7 +965,6 @@ export default {
}, },
data() { data() {
return { return {
showKnownErrors: false,
licenseText: '', licenseText: '',
isSettings: false, isSettings: false,
routeName: '', routeName: '',
@@ -1122,6 +1062,9 @@ export default {
featuredGalleryImage() { featuredGalleryImage() {
return this.project.gallery.find((img) => img.featured) return this.project.gallery.find((img) => img.featured)
}, },
requestedStatus() {
return this.project.requested_status ?? 'approved'
},
}, },
watch: { watch: {
'$route.path': { '$route.path': {
@@ -1204,19 +1147,6 @@ export default {
this.$nuxt.$loading.finish() this.$nuxt.$loading.finish()
}, },
async submitForReview() {
if (
this.project.body === '' ||
this.project.body.startsWith('# Placeholder description') ||
this.versions.length < 1 ||
this.project.client_side === 'unknown' ||
this.project.server_side === 'unknown'
) {
this.showKnownErrors = true
} else {
await this.setProcessing()
}
},
toggleChecklistCollapse() { toggleChecklistCollapse() {
this.collapsedChecklist = !this.collapsedChecklist this.collapsedChecklist = !this.collapsedChecklist
}, },
@@ -1646,13 +1576,6 @@ export default {
} }
} }
.current-status {
display: flex;
flex-direction: row;
gap: var(--spacing-card-sm);
margin-top: var(--spacing-card-md);
}
.normal-page__sidebar .mod-button { .normal-page__sidebar .mod-button {
margin-top: var(--spacing-card-sm); margin-top: var(--spacing-card-sm);
} }

View File

@@ -106,12 +106,13 @@
" "
/> />
</div> </div>
<ul <p
v-if="member.role === 'Owner' && member.oldRole !== 'Owner'" v-if="member.role === 'Owner' && member.oldRole !== 'Owner'"
class="known-errors" class="known-errors"
> >
<li>A project can only have one 'Owner'.</li> A project can only have one 'Owner'. Use the 'Transfer ownership'
</ul> button below if you no longer wish to be owner.
</p>
<template v-if="member.oldRole !== 'Owner'"> <template v-if="member.oldRole !== 'Owner'">
<span class="label"> <span class="label">
<span class="label__title">Permissions</span> <span class="label__title">Permissions</span>

View File

@@ -152,7 +152,8 @@
<li>Content containing sexual or explicit material</li> <li>Content containing sexual or explicit material</li>
<li>Content promoting or sharing harmful or hateful behavior</li> <li>Content promoting or sharing harmful or hateful behavior</li>
<li> <li>
Content with a focus on items such as alcohol, tobacco, and other drugs Content themed around or containing real-life drugs or illicit
substances
</li> </li>
<li>Content with an excessive amount of profane language</li> <li>Content with an excessive amount of profane language</li>
</ul> </ul>

View File

@@ -100,7 +100,7 @@
<template v-else> <template v-else>
<div class="sidebar__item"> <div class="sidebar__item">
<Badge <Badge
v-if="user.role === 'admin' || user.role === 'moderator'" v-if="$tag.staffRoles.includes(user.role)"
:type="user.role" :type="user.role"
/> />
<Badge v-else-if="projects.length > 0" type="creator" /> <Badge v-else-if="projects.length > 0" type="creator" />
@@ -233,12 +233,10 @@
:status=" :status="
$auth.user && $auth.user &&
($auth.user.id === user.id || ($auth.user.id === user.id ||
$auth.user.role === 'admin' || $tag.staffRoles.includes($auth.user.role))
$auth.user.role === 'moderator')
? project.status ? project.status
: null : null
" "
:has-mod-message="project.moderator_message"
:type="project.project_type" :type="project.project_type"
:color="project.color" :color="project.color"
/> />

View File

@@ -56,4 +56,6 @@ export const state = () => ({
}, },
projectViewModes: ['list', 'grid', 'gallery'], projectViewModes: ['list', 'grid', 'gallery'],
approvedStatuses: ['approved', 'archived', 'unlisted', 'private'], approvedStatuses: ['approved', 'archived', 'unlisted', 'private'],
rejectedStatuses: ['rejected', 'withheld'],
staffRoles: ['moderator', 'admin'],
}) })