Fix moderation queue, moderation status card when approved, and invalid datapack packages (#907)
* Fool behavior * Add leading underscore to packaged datapack package if it starts with a number * Hide mod status card for all approved statuses without mod messages * Fix project id sanitization
This commit is contained in:
parent
c67bc33c23
commit
17f00e6fea
@ -133,10 +133,10 @@ export default {
|
||||
this.$defaultHeaders()
|
||||
)
|
||||
|
||||
this.$refs.modal.hide()
|
||||
if (this.onClose !== null) {
|
||||
this.onClose()
|
||||
}
|
||||
this.$refs.modal.hide()
|
||||
} catch (err) {
|
||||
this.$notify({
|
||||
group: 'main',
|
||||
@ -151,11 +151,15 @@ export default {
|
||||
show() {
|
||||
this.$refs.modal.show()
|
||||
this.moderationMessage =
|
||||
this.project && this.project.moderator_message.message
|
||||
this.project &&
|
||||
this.project.moderator_message &&
|
||||
this.project.moderator_message.message
|
||||
? this.project.moderator_message.message
|
||||
: ''
|
||||
this.moderationMessageBody =
|
||||
this.project && this.project.moderator_message.body
|
||||
this.project &&
|
||||
this.project.moderator_message &&
|
||||
this.project.moderator_message.body
|
||||
? this.project.moderator_message.body
|
||||
: ''
|
||||
},
|
||||
|
||||
@ -280,9 +280,7 @@
|
||||
<div
|
||||
v-if="
|
||||
currentMember &&
|
||||
((project.status !== 'approved' &&
|
||||
project.status !== 'unlisted' &&
|
||||
project.status !== 'draft' &&
|
||||
((!$tag.approvedStatuses.includes(project.status) &&
|
||||
project.status !== 'processing') ||
|
||||
(project.moderator_message &&
|
||||
(project.moderator_message.message ||
|
||||
|
||||
@ -269,10 +269,10 @@ export default {
|
||||
},
|
||||
onModalClose() {
|
||||
this.projects.splice(
|
||||
this.projects.findIndex((x) => this.project.id === x.id),
|
||||
this.projects.findIndex((x) => this.currentProject.id === x.id),
|
||||
1
|
||||
)
|
||||
this.project = null
|
||||
this.currentProject = null
|
||||
},
|
||||
async deleteReport(index) {
|
||||
this.$nuxt.$loading.start()
|
||||
|
||||
@ -514,12 +514,20 @@ export const createDataPackVersion = async function (
|
||||
binary += String.fromCharCode(classFile[i])
|
||||
}
|
||||
|
||||
let sanitizedId = project.id
|
||||
|
||||
if (project.id.match(/^(\d+)/g)) {
|
||||
sanitizedId = '_' + sanitizedId
|
||||
}
|
||||
|
||||
sanitizedId = sanitizedId.substring(0, 8)
|
||||
|
||||
binary = binary
|
||||
.replace(
|
||||
String.fromCharCode(32) + 'needs1to1be1changed1modrinth1mod',
|
||||
String.fromCharCode(newSlug.length) + newSlug
|
||||
)
|
||||
.replace('/wrappera/', `/${project.id.substring(0, 8)}/`)
|
||||
.replace('/wrappera/', `/${sanitizedId}/`)
|
||||
|
||||
const newArr = []
|
||||
for (let i = 0; i < binary.length; i++) {
|
||||
@ -527,7 +535,7 @@ export const createDataPackVersion = async function (
|
||||
}
|
||||
|
||||
primaryZipReader.file(
|
||||
`com/modrinth/${project.id.substring(0, 8)}/ModrinthWrapper.class`,
|
||||
`com/modrinth/${sanitizedId}/ModrinthWrapper.class`,
|
||||
new Uint8Array(newArr)
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user