Custom channel emoticons WIP (#130)

This commit is contained in:
John Livingston
2024-06-06 11:36:07 +02:00
parent aa9697074a
commit 92e9d6d1af
10 changed files with 205 additions and 30 deletions

View File

@ -184,10 +184,16 @@ export class ChannelDetailsService {
for (const [i, e] of channelEmojis.customEmojis.entries()) {
propertiesError[`emojis.${i}.sn`] = []
// FIXME: the ":" should not be in the value, but added afterward.
if (!/^:[\w-]+:$/.test(e.sn)) {
if (e.sn === '') {
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.Missing)
} else if (!/^:[\w-]+:$/.test(e.sn)) {
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.WrongFormat)
}
propertiesError[`emojis.${i}.url`] = []
if (!e.url) {
propertiesError[`emojis.${i}.url`].push(ValidationErrorType.Missing)
}
}
if (Object.values(propertiesError).find(e => e.length > 0)) {
@ -227,7 +233,5 @@ export class ChannelDetailsService {
}
throw new Error('Can\'t get channel emojis options.')
}
return response.json()
}
}