diff --git a/CHANGELOG b/CHANGELOG index 7763a5d11..fc285a0bc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ Motions: - Removed server side image to base64 transformation and added local transformation [#2705] - Added support for export motions in a zip archive [#3189]. +- Bugfix: changing motion line length did not invalidate cache [#3202] Core: - No reload on logoff. OpenSlides is now a full single page diff --git a/openslides/motions/static/js/motions/linenumbering.js b/openslides/motions/static/js/motions/linenumbering.js index f7aa9a90a..93faed1e9 100644 --- a/openslides/motions/static/js/motions/linenumbering.js +++ b/openslides/motions/static/js/motions/linenumbering.js @@ -475,7 +475,7 @@ angular.module('OpenSlidesApp.motions.lineNumbering', []) newRoot = this.insertLineNumbersNode(html, lineLength, highlight, firstLine); newHtml = newRoot.innerHTML; } else { - var cacheKey = this.djb2hash(html); + var cacheKey = this.djb2hash(lineLength.toString() + html); newHtml = lineNumberCache.get(cacheKey); if (angular.isUndefined(newHtml)) { diff --git a/tests/karma/motions/linenumbering.service.test.js b/tests/karma/motions/linenumbering.service.test.js index e1b57d30e..4c905b190 100644 --- a/tests/karma/motions/linenumbering.service.test.js +++ b/tests/karma/motions/linenumbering.service.test.js @@ -389,4 +389,13 @@ describe('linenumbering', function () { expect(highlighted).toBe(noMarkup(1) + 'Lorem ' + brMarkup(2) + 'ipsum ' + brMarkup(3) + 'dolor' + brMarkup(4) + 'sit ' + brMarkup(5) + 'amet'); }); }); + + describe('caching', function() { + it('caches based on line length', function () { + var inHtml = '
' +longstr(100) + '
'; + var outHtml80 = lineNumberingService.insertLineNumbers(inHtml, 80); + var outHtml70 = lineNumberingService.insertLineNumbers(inHtml, 70); + expect(outHtml70).not.toBe(outHtml80); + }); + }); });