From c6b020a9e73696eb24c1ccdab227e2d8e25ea022 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 2 Sep 2021 08:53:44 +0200 Subject: [PATCH] Rename TimelineList to TimelineView for consistency --- src/domain/session/room/timeline/tiles/EncryptedEventTile.js | 2 +- src/platform/web/ui/session/room/MessageComposer.js | 2 +- src/platform/web/ui/session/room/RoomView.js | 4 ++-- .../web/ui/session/room/{TimelineList.js => TimelineView.js} | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) rename src/platform/web/ui/session/room/{TimelineList.js => TimelineView.js} (97%) diff --git a/src/domain/session/room/timeline/tiles/EncryptedEventTile.js b/src/domain/session/room/timeline/tiles/EncryptedEventTile.js index 07dd763b..b96e2d85 100644 --- a/src/domain/session/room/timeline/tiles/EncryptedEventTile.js +++ b/src/domain/session/room/timeline/tiles/EncryptedEventTile.js @@ -22,7 +22,7 @@ export class EncryptedEventTile extends BaseTextTile { const parentResult = super.updateEntry(entry, params); // event got decrypted, recreate the tile and replace this one with it if (entry.eventType !== "m.room.encrypted") { - // the "shape" parameter trigger tile recreation in TimelineList + // the "shape" parameter trigger tile recreation in TimelineView return UpdateAction.Replace("shape"); } else { return parentResult; diff --git a/src/platform/web/ui/session/room/MessageComposer.js b/src/platform/web/ui/session/room/MessageComposer.js index c6e8a1ee..780baef4 100644 --- a/src/platform/web/ui/session/room/MessageComposer.js +++ b/src/platform/web/ui/session/room/MessageComposer.js @@ -17,7 +17,7 @@ limitations under the License. import {TemplateView} from "../../general/TemplateView.js"; import {Popup} from "../../general/Popup.js"; import {Menu} from "../../general/Menu.js"; -import {viewClassForEntry} from "./TimelineList.js" +import {viewClassForEntry} from "./TimelineView.js" export class MessageComposer extends TemplateView { constructor(viewModel) { diff --git a/src/platform/web/ui/session/room/RoomView.js b/src/platform/web/ui/session/room/RoomView.js index 71eb1e13..faa4637e 100644 --- a/src/platform/web/ui/session/room/RoomView.js +++ b/src/platform/web/ui/session/room/RoomView.js @@ -18,7 +18,7 @@ limitations under the License. import {TemplateView} from "../../general/TemplateView.js"; import {Popup} from "../../general/Popup.js"; import {Menu} from "../../general/Menu.js"; -import {TimelineList} from "./TimelineList.js"; +import {TimelineView} from "./TimelineView.js"; import {TimelineLoadingView} from "./TimelineLoadingView.js"; import {MessageComposer} from "./MessageComposer.js"; import {RoomArchivedView} from "./RoomArchivedView.js"; @@ -54,7 +54,7 @@ export class RoomView extends TemplateView { t.div({className: "RoomView_error"}, vm => vm.error), t.mapView(vm => vm.timelineViewModel, timelineViewModel => { return timelineViewModel ? - new TimelineList(timelineViewModel) : + new TimelineView(timelineViewModel) : new TimelineLoadingView(vm); // vm is just needed for i18n }), t.view(bottomView), diff --git a/src/platform/web/ui/session/room/TimelineList.js b/src/platform/web/ui/session/room/TimelineView.js similarity index 97% rename from src/platform/web/ui/session/room/TimelineList.js rename to src/platform/web/ui/session/room/TimelineView.js index e0179e5d..2bac6c1b 100644 --- a/src/platform/web/ui/session/room/TimelineList.js +++ b/src/platform/web/ui/session/room/TimelineView.js @@ -40,7 +40,7 @@ export function viewClassForEntry(entry) { } } -export class TimelineList extends ListView { +export class TimelineView extends ListView { constructor(viewModel) { const options = { className: "Timeline bottom-aligned-scroll", @@ -94,7 +94,8 @@ export class TimelineList extends ListView { this._loadAtTopWhile(() => { const contentHeight = root.scrollHeight; const amountGrown = contentHeight - beforeContentHeight; - root.scrollTop = root.scrollTop + (contentHeight - lastContentHeight); + const topDiff = contentHeight - lastContentHeight; + root.scrollBy(0, topDiff); lastContentHeight = contentHeight; return amountGrown < PAGINATE_OFFSET; });