Fix #449: Remove the constraint for custom emojis shortnames to have ":" at the beginning and at the end.
This commit is contained in:
@ -193,9 +193,7 @@ export class ChannelEmojisElement extends LivechatElement {
|
||||
}
|
||||
|
||||
const url = await this._convertImageToDataUrl(entry.url)
|
||||
let sn = entry.sn as string
|
||||
if (!sn.startsWith(':')) { sn = ':' + sn }
|
||||
if (!sn.endsWith(':')) { sn += ':' }
|
||||
const sn = entry.sn as string
|
||||
|
||||
const item: ChannelEmojisConfiguration['emojis']['customEmojis'][0] = {
|
||||
sn,
|
||||
|
@ -91,12 +91,6 @@ export function tplChannelEmojis (el: ChannelEmojisElement): TemplateResult {
|
||||
el.resetValidation(e)
|
||||
if (el.channelEmojisConfiguration) {
|
||||
el.channelEmojisConfiguration.emojis.customEmojis = e.detail
|
||||
// Fixing missing ':' for shortnames:
|
||||
for (const desc of el.channelEmojisConfiguration.emojis.customEmojis) {
|
||||
if (desc.sn === '') { continue }
|
||||
if (!desc.sn.startsWith(':')) { desc.sn = ':' + desc.sn }
|
||||
if (!desc.sn.endsWith(':')) { desc.sn += ':' }
|
||||
}
|
||||
el.requestUpdate('channelEmojisConfiguration')
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ export class ChannelDetailsService {
|
||||
propertiesError[`emojis.${i}.sn`] = []
|
||||
if (e.sn === '') {
|
||||
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.Missing)
|
||||
} else if (!/^:[\w-]+:$/.test(e.sn)) {
|
||||
} else if (!/^:?[\w-]+:?$/.test(e.sn)) { // optional ':' at the beggining and at the end
|
||||
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.WrongFormat)
|
||||
} else if (seen.has(e.sn)) {
|
||||
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.Duplicate)
|
||||
|
Reference in New Issue
Block a user