Use NonPersistedEventEntry

This commit is contained in:
RMidhunSuresh 2021-12-07 16:01:30 +05:30
parent d191b327c6
commit 053dcf39a5
2 changed files with 30 additions and 1 deletions

View file

@ -30,6 +30,7 @@ import {DecryptionSource} from "../e2ee/common.js";
import {ensureLogItem} from "../../logging/utils"; import {ensureLogItem} from "../../logging/utils";
import {PowerLevels} from "./PowerLevels.js"; import {PowerLevels} from "./PowerLevels.js";
import {RetainedObservableValue} from "../../observable/ObservableValue"; import {RetainedObservableValue} from "../../observable/ObservableValue";
import {NonPersistedEventEntry} from "./timeline/entries/NonPersistedEventEntry";
const EVENT_ENCRYPTED_TYPE = "m.room.encrypted"; const EVENT_ENCRYPTED_TYPE = "m.room.encrypted";
@ -570,7 +571,7 @@ export class BaseRoom extends EventEmitter {
displayName: member.content.displayname, displayName: member.content.displayname,
avatarUrl: member.content.avatar_url avatarUrl: member.content.avatar_url
}; };
return new EventEntry(entry, this._fragmentIdComparer); return new NonPersistedEventEntry(entry, this._fragmentIdComparer);
} }

View file

@ -0,0 +1,28 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import {EventEntry} from "./EventEntry.js";
// EventEntry but without the two properties that are populated via SyncWriter
export class NonPersistedEventEntry extends EventEntry {
get fragmentId() {
throw new Error("Cannot access fragmentId for non-persisted EventEntry");
}
get entryIndex() {
throw new Error("Cannot access entryIndex for non-persisted EventEntry");
}
}