Changeset View
Changeset View
Standalone View
Standalone View
apps/ecash-herald/src/telegram.js
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | splitOverflowTgMsg: function (tgMsgArray) { | ||||
if (thisTgMsgStringLength - 2 > TG_MSG_MAX_LENGTH) { | if (thisTgMsgStringLength - 2 > TG_MSG_MAX_LENGTH) { | ||||
// Build a msg string with preceding lines, i.e. do not include this i'th line | // Build a msg string with preceding lines, i.e. do not include this i'th line | ||||
const sliceEndIndex = i; // Note that the slice end index is not included | const sliceEndIndex = i; // Note that the slice end index is not included | ||||
tgMsgStrings.push( | tgMsgStrings.push( | ||||
tgMsgArray.slice(sliceStartIndex, sliceEndIndex).join('\n'), | tgMsgArray.slice(sliceStartIndex, sliceEndIndex).join('\n'), | ||||
); | ); | ||||
// Reset sliceStartIndex and thisTgMsgStringLength for the next message | // Reset sliceStartIndex and thisTgMsgStringLength for the next message | ||||
sliceStartIndex = sliceEndIndex; | sliceStartIndex = sliceEndIndex; | ||||
thisTgMsgStringLength = 0; | // You will be including this 'i'th line in the next batch, don't reset to zero | ||||
thisTgMsgStringLength = thisLine.length + 2; | |||||
bytesofman: bugfix uncovered with longer mocks
this would be nice to fix on its own, but it changes all… | |||||
} | } | ||||
} | } | ||||
// Build a tg msg of all unused lines, if you have them | // Build a tg msg of all unused lines, if you have them | ||||
if (sliceStartIndex < tgMsgArray.length) { | if (sliceStartIndex < tgMsgArray.length) { | ||||
tgMsgStrings.push(tgMsgArray.slice(sliceStartIndex).join('\n')); | tgMsgStrings.push(tgMsgArray.slice(sliceStartIndex).join('\n')); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |
bugfix uncovered with longer mocks
this would be nice to fix on its own, but it changes all the mocks, which require special preparation. The mocks need to be updated for this feature anyway.