Skip to content

Commit 8b04303

Browse files
authored
Moderation: server languages and description stage tweaks (modrinth#5515)
* Description button tweaks * server languages * pretty
1 parent 2b8175a commit 8b04303

4 files changed

Lines changed: 49 additions & 29 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Supported Languages
2+
3+
Currently, you've selected %PROJECT_LANGUAGE_COUNT% [Languages](%PROJECT_LANGUAGE_SETTINGS%), per section 5.1 of %RULES% we ask that you confirm all selected languages are accurate.
4+
5+
Selected languages should represent what players can expect to see on your server, and all players should be able to get the full experience out of your server even if they only understand one of the selected languages.

‎packages/moderation/src/data/stages/description.ts‎

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,66 +10,58 @@ const description: Stage = {
1010
guidance_url: 'https://modrinth.com/legal/rules#general-expectations',
1111
navigate: '/',
1212
actions: [
13-
{
14-
id: 'description_insufficient',
15-
type: 'button',
16-
label: 'Insufficient (custom)',
17-
weight: 400,
18-
suggestedStatus: 'flagged',
19-
severity: 'medium',
20-
message: async () =>
21-
(await import('../messages/description/insufficient/insufficient.md?raw')).default,
22-
relevantExtraInput: [
23-
{
24-
label: 'Please elaborate on how the author can improve their description.',
25-
variable: 'EXPLAINER',
26-
large: true,
27-
required: true,
28-
},
29-
],
30-
disablesActions: [
31-
'description_insufficient_packs',
32-
'description_insufficient_projects',
33-
'description_insufficient_servers',
34-
],
35-
} as ButtonAction,
3613
{
3714
id: 'description_insufficient_packs',
3815
type: 'button',
3916
label: 'Insufficient',
40-
weight: 401,
17+
weight: 400,
4118
suggestedStatus: 'flagged',
4219
severity: 'medium',
4320
shouldShow: (project, projectV3) =>
4421
project.project_type === 'modpack' && !projectV3?.minecraft_server,
4522
message: async () =>
4623
(await import('../messages/description/insufficient/insufficient-packs.md?raw')).default,
47-
disablesActions: ['description_insufficient'],
4824
} as ButtonAction,
4925
{
5026
id: 'description_insufficient_projects',
5127
type: 'button',
5228
label: 'Insufficient',
53-
weight: 401,
29+
weight: 400,
5430
suggestedStatus: 'flagged',
5531
severity: 'medium',
5632
shouldShow: (project, projectV3) =>
5733
project.project_type !== 'modpack' && !projectV3?.minecraft_server,
5834
message: async () =>
5935
(await import('../messages/description/insufficient/insufficient-projects.md?raw')).default,
60-
disablesActions: ['description_insufficient'],
6136
} as ButtonAction,
6237
{
6338
id: 'description_insufficient_servers',
6439
type: 'button',
6540
label: 'Insufficient',
66-
weight: 401,
41+
weight: 400,
6742
suggestedStatus: 'flagged',
6843
severity: 'medium',
6944
shouldShow: (project, projectV3) => !!projectV3?.minecraft_java_server,
7045
message: async () =>
7146
(await import('../messages/description/insufficient/insufficient-servers.md?raw')).default,
72-
disablesActions: ['description_insufficient'],
47+
} as ButtonAction,
48+
{
49+
id: 'description_insufficient',
50+
type: 'button',
51+
label: 'Insufficient (custom)',
52+
weight: 401,
53+
suggestedStatus: 'flagged',
54+
severity: 'medium',
55+
message: async () =>
56+
(await import('../messages/description/insufficient/insufficient.md?raw')).default,
57+
relevantExtraInput: [
58+
{
59+
label: 'Please elaborate on how the author can improve their description.',
60+
variable: 'EXPLAINER',
61+
large: true,
62+
required: true,
63+
},
64+
],
7365
} as ButtonAction,
7466
{
7567
id: 'description_non_english',

‎packages/moderation/src/data/stages/rule-following.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,28 @@ const ruleFollowing: Stage = {
3535
weight: 0,
3636
suggestedStatus: 'rejected',
3737
severity: 'critical',
38+
shouldShow(project, projectV3) {
39+
return !!projectV3?.minecraft_server
40+
},
3841
message: async () => (await import('../messages/paid-access-server.md?raw')).default,
3942
},
43+
{
44+
id: 'excessive_languages',
45+
type: 'button',
46+
label: 'Excessive languages',
47+
weight: 0,
48+
suggestedStatus: 'flagged',
49+
severity: 'low',
50+
shouldShow(project, projectV3) {
51+
return (
52+
!!projectV3?.minecraft_server &&
53+
!!projectV3?.minecraft_server?.languages?.length &&
54+
projectV3?.minecraft_server?.languages?.length > 4
55+
)
56+
},
57+
message: async () =>
58+
(await import('../messages/misc-metadata/excessive_languages-server.md?raw')).default,
59+
},
4060
],
4161
}
4262

‎packages/moderation/src/utils.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,5 +412,8 @@ export function flattenProjectV3Variables(
412412
vars['PROJECT_SITE_URL'] = projectV3.link_urls?.site?.url || 'None'
413413
vars['PROJECT_STORE_URL'] = projectV3.link_urls?.store?.url || 'None'
414414

415+
vars['PROJECT_LANGUAGES'] = projectV3.minecraft_server?.languages?.toString() || 'None'
416+
vars['PROJECT_LANGUAGE_COUNT'] = (projectV3.minecraft_server?.languages?.length || 0).toString()
417+
415418
return vars
416419
}

0 commit comments

Comments
 (0)