diff --git a/src/domain/session/room/timeline/tiles/GapTile.js b/src/domain/session/room/timeline/tiles/GapTile.js index 1b05c1c8..dbf5cf63 100644 --- a/src/domain/session/room/timeline/tiles/GapTile.js +++ b/src/domain/session/room/timeline/tiles/GapTile.js @@ -72,3 +72,31 @@ export class GapTile extends SimpleTile { return null; } } + +import {FragmentBoundaryEntry} from "../../../../../matrix/room/timeline/entries/FragmentBoundaryEntry.js"; +export function tests() { + return { + "uses updated token to fill": async assert => { + let currentToken = 5; + const fragment = { + id: 0, + previousToken: currentToken, + roomId: "!abc" + }; + const room = { + async fillGap(entry) { + console.log(entry.token, currentToken); + assert.equal(entry.token, currentToken); + currentToken += 1; + const newEntry = entry.withUpdatedFragment(Object.assign({}, fragment, {previousToken: currentToken})); + tile.updateEntry(newEntry); + } + }; + const tile = new GapTile({entry: new FragmentBoundaryEntry(fragment, true), room}); + await tile.fill(); + await tile.fill(); + await tile.fill(); + assert.equal(currentToken, 8); + } + } +} \ No newline at end of file diff --git a/src/domain/session/room/timeline/tiles/SimpleTile.js b/src/domain/session/room/timeline/tiles/SimpleTile.js index 29f9980b..07529b51 100644 --- a/src/domain/session/room/timeline/tiles/SimpleTile.js +++ b/src/domain/session/room/timeline/tiles/SimpleTile.js @@ -85,7 +85,7 @@ export class SimpleTile extends ViewModel { // update received for already included (falls within sort keys) entry updateEntry(entry, param) { const renderedAsRedacted = this.shape === "redacted"; - if (entry.isRedacted !== renderedAsRedacted) { + if (!entry.isGap && entry.isRedacted !== renderedAsRedacted) { // recreate the tile if the entry becomes redacted return UpdateAction.Replace("shape"); } else {