Fix proposal naming & editing: remove crutch code, validate JSON in proposal 15 directly, add title to empty hacker proposal 21
This commit is contained in:
parent
59c252b826
commit
1f24d46360
@ -705,16 +705,24 @@ const actions = {
|
|||||||
break
|
break
|
||||||
case 13:
|
case 13:
|
||||||
text = text.replace(/\\\\n\\\\n(\s)?(\\n)?/g, '\\n')
|
text = text.replace(/\\\\n\\\\n(\s)?(\\n)?/g, '\\n')
|
||||||
|
break
|
||||||
|
// Fix invalid JSON in proposal 15: replace single quotes with double and add comma before description
|
||||||
|
case 15:
|
||||||
|
text = text.replaceAll(`'`, `"`)
|
||||||
|
text = text.replace('"description"', ',"description"')
|
||||||
|
break
|
||||||
|
case 16:
|
||||||
|
text = text.replace('#16: ', '')
|
||||||
|
break
|
||||||
|
// Add title to empty (without title and description) hacker proposal 21
|
||||||
|
case 21:
|
||||||
|
return {
|
||||||
|
title: 'Proposal #21: Restore Governance',
|
||||||
|
description: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.includes(`'`)) {
|
|
||||||
text = text.replaceAll(`'`, `"`)
|
|
||||||
}
|
|
||||||
if (text.includes(`" "`)) {
|
|
||||||
text = text.replace(`" "`, `", "`)
|
|
||||||
}
|
|
||||||
|
|
||||||
let title, description, rest
|
let title, description, rest
|
||||||
try {
|
try {
|
||||||
;({ title, description } = JSON.parse(text))
|
;({ title, description } = JSON.parse(text))
|
||||||
|
Loading…
Reference in New Issue
Block a user