Fix #449: Remove the constraint for custom emojis shortnames to have ":" at the beginning and at the end.
This commit is contained in:
parent
bd211d777e
commit
934c07e34e
@ -7,6 +7,10 @@
|
|||||||
* #233: new option to [mute anonymous users](https://livingston.frama.io/peertube-plugin-livechat/documentation/user/streamers/moderation/).
|
* #233: new option to [mute anonymous users](https://livingston.frama.io/peertube-plugin-livechat/documentation/user/streamers/moderation/).
|
||||||
* #18: terms & conditions. You can configure terms&conditions on your instance that will be shown to each joining users. Streamers can also add [terms&conditions in their channels options](https://livingston.frama.io/peertube-plugin-livechat/documentation/user/streamers/terms/).
|
* #18: terms & conditions. You can configure terms&conditions on your instance that will be shown to each joining users. Streamers can also add [terms&conditions in their channels options](https://livingston.frama.io/peertube-plugin-livechat/documentation/user/streamers/terms/).
|
||||||
|
|
||||||
|
### Minor changes and fixes
|
||||||
|
|
||||||
|
* Fix #449: Remove the constraint for custom emojis shortnames to have ":" at the beginning and at the end.
|
||||||
|
|
||||||
## 10.1.2
|
## 10.1.2
|
||||||
|
|
||||||
* Fix: clicking on the import custom emojis button, without selected any file, was resulting in a state with all action button disabled.
|
* Fix: clicking on the import custom emojis button, without selected any file, was resulting in a state with all action button disabled.
|
||||||
|
@ -193,9 +193,7 @@ export class ChannelEmojisElement extends LivechatElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const url = await this._convertImageToDataUrl(entry.url)
|
const url = await this._convertImageToDataUrl(entry.url)
|
||||||
let sn = entry.sn as string
|
const sn = entry.sn as string
|
||||||
if (!sn.startsWith(':')) { sn = ':' + sn }
|
|
||||||
if (!sn.endsWith(':')) { sn += ':' }
|
|
||||||
|
|
||||||
const item: ChannelEmojisConfiguration['emojis']['customEmojis'][0] = {
|
const item: ChannelEmojisConfiguration['emojis']['customEmojis'][0] = {
|
||||||
sn,
|
sn,
|
||||||
|
@ -91,12 +91,6 @@ export function tplChannelEmojis (el: ChannelEmojisElement): TemplateResult {
|
|||||||
el.resetValidation(e)
|
el.resetValidation(e)
|
||||||
if (el.channelEmojisConfiguration) {
|
if (el.channelEmojisConfiguration) {
|
||||||
el.channelEmojisConfiguration.emojis.customEmojis = e.detail
|
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')
|
el.requestUpdate('channelEmojisConfiguration')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ export class ChannelDetailsService {
|
|||||||
propertiesError[`emojis.${i}.sn`] = []
|
propertiesError[`emojis.${i}.sn`] = []
|
||||||
if (e.sn === '') {
|
if (e.sn === '') {
|
||||||
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.Missing)
|
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)
|
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.WrongFormat)
|
||||||
} else if (seen.has(e.sn)) {
|
} else if (seen.has(e.sn)) {
|
||||||
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.Duplicate)
|
propertiesError[`emojis.${i}.sn`].push(ValidationErrorType.Duplicate)
|
||||||
|
@ -512,7 +512,8 @@ livechat_configuration_channel_emojis_desc: |
|
|||||||
livechat_emojis_shortname: 'Short name'
|
livechat_emojis_shortname: 'Short name'
|
||||||
livechat_emojis_shortname_desc: |
|
livechat_emojis_shortname_desc: |
|
||||||
You can use emojis using ":shortname:".
|
You can use emojis using ":shortname:".
|
||||||
The short name can only contain alphanumerical characters, underscores and hyphens.
|
The short name can start and/or end by a colon (:), and only contain alphanumerical characters, underscores and hyphens.
|
||||||
|
It is strongly recommended to start them by a colon, so that users can use autocompletion (by typing ":" then press TAB).
|
||||||
livechat_emojis_file: 'File'
|
livechat_emojis_file: 'File'
|
||||||
livechat_emojis_file_desc: |
|
livechat_emojis_file_desc: |
|
||||||
The emoji file.
|
The emoji file.
|
||||||
|
@ -141,7 +141,7 @@ export class Emojis {
|
|||||||
* @param sn short name
|
* @param sn short name
|
||||||
*/
|
*/
|
||||||
public validShortName (sn: any): boolean {
|
public validShortName (sn: any): boolean {
|
||||||
if ((typeof sn !== 'string') || !/^:[\w-]+:$/.test(sn)) {
|
if ((typeof sn !== 'string') || !/^:?[\w-]+:?$/.test(sn)) {
|
||||||
this.logger.debug('Short name invalid: ' + (typeof sn === 'string' ? sn : '???'))
|
this.logger.debug('Short name invalid: ' + (typeof sn === 'string' ? sn : '???'))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user