Fix #437: removing last line if empty when importing emojis.
This commit is contained in:
parent
a0b4b5f61a
commit
48905dd70d
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
## 10.1.1 (Not released yet)
|
## 10.1.1 (Not released yet)
|
||||||
|
|
||||||
* #436: Saving emojis per batch, to avoid hitting max payload limit.
|
* Fix #436: Saving emojis per batch, to avoid hitting max payload limit.
|
||||||
* Fix: the emojis import function could add more entries than max allowed emoji count.
|
* Fix: the emojis import function could add more entries than max allowed emoji count.
|
||||||
|
* Fix #437: removing last line if empty when importing emojis.
|
||||||
|
|
||||||
## 10.1.0
|
## 10.1.0
|
||||||
|
|
||||||
|
@ -174,6 +174,15 @@ export class ChannelEmojisElement extends LivechatElement {
|
|||||||
if (!Array.isArray(json)) {
|
if (!Array.isArray(json)) {
|
||||||
throw new Error('Invalid data, an array was expected')
|
throw new Error('Invalid data, an array was expected')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Before adding new entries, we check if the last current line is empty,
|
||||||
|
// and remove it in such case.
|
||||||
|
// See https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/437
|
||||||
|
const last = this.channelEmojisConfiguration?.emojis.customEmojis.slice(-1)[0]
|
||||||
|
if (last && last.sn === '' && last.url === '') {
|
||||||
|
this.channelEmojisConfiguration?.emojis.customEmojis.pop()
|
||||||
|
}
|
||||||
|
|
||||||
for (const entry of json) {
|
for (const entry of json) {
|
||||||
if (typeof entry !== 'object') {
|
if (typeof entry !== 'object') {
|
||||||
throw new Error('Invalid data')
|
throw new Error('Invalid data')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user