1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Increase abuse length to 3000

And correctly handle new lines
This commit is contained in:
Chocobozzz 2019-01-14 16:48:38 +01:00
parent 9a39392a7e
commit 1506307f2f
No known key found for this signature in database
GPG key ID: 583A612D890159BE
28 changed files with 136 additions and 80 deletions

View file

@ -102,12 +102,18 @@ function objectToFormData (obj: any, form?: FormData, namespace?: string) {
return fd
}
function lineFeedToHtml (obj: any, keyToNormalize: string) {
function objectLineFeedToHtml (obj: any, keyToNormalize: string) {
return immutableAssign(obj, {
[keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />')
[keyToNormalize]: lineFeedToHtml(obj[keyToNormalize])
})
}
function lineFeedToHtml (text: string) {
if (!text) return text
return text.replace(/\r?\n|\r/g, '<br />')
}
function removeElementFromArray <T> (arr: T[], elem: T) {
const index = arr.indexOf(elem)
if (index !== -1) arr.splice(index, 1)
@ -131,6 +137,7 @@ function scrollToTop () {
export {
sortBy,
durationToString,
lineFeedToHtml,
objectToUrlEncoded,
getParameterByName,
populateAsyncUserVideoChannels,
@ -138,7 +145,7 @@ export {
dateToHuman,
immutableAssign,
objectToFormData,
lineFeedToHtml,
objectLineFeedToHtml,
removeElementFromArray,
scrollToTop
}