You've already forked AstralRinth
forked from didirus/AstralRinth
Fix project settings not allowing you to remove links & trim certain project fields (#895)
* Fix project settings not allowing you to remove links * Trim project fields Closes #850
This commit is contained in:
@@ -153,10 +153,10 @@ export default {
|
|||||||
formData.append(
|
formData.append(
|
||||||
'data',
|
'data',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
title: this.name,
|
title: this.name.trim(),
|
||||||
project_type: projectType.actual,
|
project_type: projectType.actual,
|
||||||
slug: this.slug,
|
slug: this.slug,
|
||||||
description: this.description,
|
description: this.description.trim(),
|
||||||
body: `# Placeholder description
|
body: `# Placeholder description
|
||||||
This is your new ${projectType.display}, ${
|
This is your new ${projectType.display}, ${
|
||||||
this.name
|
this.name
|
||||||
@@ -235,9 +235,11 @@ Questions? [Join the Modrinth Discord for support!](https://discord.gg/EUHuJHt)`
|
|||||||
updatedName() {
|
updatedName() {
|
||||||
if (!this.manualSlug) {
|
if (!this.manualSlug) {
|
||||||
this.slug = this.name
|
this.slug = this.name
|
||||||
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replaceAll(' ', '-')
|
.replaceAll(' ', '-')
|
||||||
.replaceAll(/[^a-zA-Z0-9!@$()`.+,_"-]/g, '')
|
.replaceAll(/[^a-zA-Z0-9!@$()`.+,_"-]/g, '')
|
||||||
|
.replaceAll(/--+/gm, '-')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -323,13 +323,13 @@ export default {
|
|||||||
const data = {}
|
const data = {}
|
||||||
|
|
||||||
if (this.name !== this.project.title) {
|
if (this.name !== this.project.title) {
|
||||||
data.title = this.name
|
data.title = this.name.trim()
|
||||||
}
|
}
|
||||||
if (this.slug !== this.project.slug) {
|
if (this.slug !== this.project.slug) {
|
||||||
data.slug = this.slug
|
data.slug = this.slug.trim()
|
||||||
}
|
}
|
||||||
if (this.summary !== this.project.description) {
|
if (this.summary !== this.project.description) {
|
||||||
data.description = this.summary
|
data.description = this.summary.trim()
|
||||||
}
|
}
|
||||||
if (this.clientSide !== this.project.client_side) {
|
if (this.clientSide !== this.project.client_side) {
|
||||||
data.client_side = this.clientSide
|
data.client_side = this.clientSide
|
||||||
|
|||||||
@@ -189,16 +189,17 @@ export default {
|
|||||||
const data = {}
|
const data = {}
|
||||||
|
|
||||||
if (this.checkDifference(this.issuesUrl, this.project.issues_url)) {
|
if (this.checkDifference(this.issuesUrl, this.project.issues_url)) {
|
||||||
data.issues_url = this.issuesUrl
|
data.issues_url = this.issuesUrl === '' ? null : this.issuesUrl.trim()
|
||||||
}
|
}
|
||||||
if (this.checkDifference(this.sourceUrl, this.project.source_url)) {
|
if (this.checkDifference(this.sourceUrl, this.project.source_url)) {
|
||||||
data.source_url = this.sourceUrl
|
data.source_url = this.sourceUrl === '' ? null : this.sourceUrl.trim()
|
||||||
}
|
}
|
||||||
if (this.checkDifference(this.wikiUrl, this.project.wiki_url)) {
|
if (this.checkDifference(this.wikiUrl, this.project.wiki_url)) {
|
||||||
data.wiki_url = this.wikiUrl
|
data.wiki_url = this.wikiUrl === '' ? null : this.wikiUrl.trim()
|
||||||
}
|
}
|
||||||
if (this.checkDifference(this.discordUrl, this.project.discord_url)) {
|
if (this.checkDifference(this.discordUrl, this.project.discord_url)) {
|
||||||
data.discord_url = this.discordUrl
|
data.discord_url =
|
||||||
|
this.discordUrl === '' ? null : this.discordUrl.trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
const donationLinks = this.donationLinks.filter(
|
const donationLinks = this.donationLinks.filter(
|
||||||
@@ -267,11 +268,14 @@ export default {
|
|||||||
url: null,
|
url: null,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
checkDifference(a, b) {
|
checkDifference(newLink, existingLink) {
|
||||||
if (!a && !b) {
|
if (newLink === '' && existingLink !== null) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (!newLink && !existingLink) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return a !== b
|
return newLink !== existingLink
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ export default {
|
|||||||
.data
|
.data
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
user_id: user.id,
|
user_id: user.id.trim(),
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.$axios.post(
|
await this.$axios.post(
|
||||||
|
|||||||
Reference in New Issue
Block a user