Rename TimelineList to TimelineView for consistency

This commit is contained in:
Bruno Windels 2021-09-02 08:53:44 +02:00
parent ed082c9869
commit c6b020a9e7
4 changed files with 7 additions and 6 deletions

View File

@ -22,7 +22,7 @@ export class EncryptedEventTile extends BaseTextTile {
const parentResult = super.updateEntry(entry, params); const parentResult = super.updateEntry(entry, params);
// event got decrypted, recreate the tile and replace this one with it // event got decrypted, recreate the tile and replace this one with it
if (entry.eventType !== "m.room.encrypted") { 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"); return UpdateAction.Replace("shape");
} else { } else {
return parentResult; return parentResult;

View File

@ -17,7 +17,7 @@ limitations under the License.
import {TemplateView} from "../../general/TemplateView.js"; import {TemplateView} from "../../general/TemplateView.js";
import {Popup} from "../../general/Popup.js"; import {Popup} from "../../general/Popup.js";
import {Menu} from "../../general/Menu.js"; import {Menu} from "../../general/Menu.js";
import {viewClassForEntry} from "./TimelineList.js" import {viewClassForEntry} from "./TimelineView.js"
export class MessageComposer extends TemplateView { export class MessageComposer extends TemplateView {
constructor(viewModel) { constructor(viewModel) {

View File

@ -18,7 +18,7 @@ limitations under the License.
import {TemplateView} from "../../general/TemplateView.js"; import {TemplateView} from "../../general/TemplateView.js";
import {Popup} from "../../general/Popup.js"; import {Popup} from "../../general/Popup.js";
import {Menu} from "../../general/Menu.js"; import {Menu} from "../../general/Menu.js";
import {TimelineList} from "./TimelineList.js"; import {TimelineView} from "./TimelineView.js";
import {TimelineLoadingView} from "./TimelineLoadingView.js"; import {TimelineLoadingView} from "./TimelineLoadingView.js";
import {MessageComposer} from "./MessageComposer.js"; import {MessageComposer} from "./MessageComposer.js";
import {RoomArchivedView} from "./RoomArchivedView.js"; import {RoomArchivedView} from "./RoomArchivedView.js";
@ -54,7 +54,7 @@ export class RoomView extends TemplateView {
t.div({className: "RoomView_error"}, vm => vm.error), t.div({className: "RoomView_error"}, vm => vm.error),
t.mapView(vm => vm.timelineViewModel, timelineViewModel => { t.mapView(vm => vm.timelineViewModel, timelineViewModel => {
return timelineViewModel ? return timelineViewModel ?
new TimelineList(timelineViewModel) : new TimelineView(timelineViewModel) :
new TimelineLoadingView(vm); // vm is just needed for i18n new TimelineLoadingView(vm); // vm is just needed for i18n
}), }),
t.view(bottomView), t.view(bottomView),

View File

@ -40,7 +40,7 @@ export function viewClassForEntry(entry) {
} }
} }
export class TimelineList extends ListView { export class TimelineView extends ListView {
constructor(viewModel) { constructor(viewModel) {
const options = { const options = {
className: "Timeline bottom-aligned-scroll", className: "Timeline bottom-aligned-scroll",
@ -94,7 +94,8 @@ export class TimelineList extends ListView {
this._loadAtTopWhile(() => { this._loadAtTopWhile(() => {
const contentHeight = root.scrollHeight; const contentHeight = root.scrollHeight;
const amountGrown = contentHeight - beforeContentHeight; const amountGrown = contentHeight - beforeContentHeight;
root.scrollTop = root.scrollTop + (contentHeight - lastContentHeight); const topDiff = contentHeight - lastContentHeight;
root.scrollBy(0, topDiff);
lastContentHeight = contentHeight; lastContentHeight = contentHeight;
return amountGrown < PAGINATE_OFFSET; return amountGrown < PAGINATE_OFFSET;
}); });