diff --git a/src/domain/session/room/timeline/tiles/RoomMemberTile.js b/src/domain/session/room/timeline/tiles/RoomMemberTile.js index ce41f031..1c6de030 100644 --- a/src/domain/session/room/timeline/tiles/RoomMemberTile.js +++ b/src/domain/session/room/timeline/tiles/RoomMemberTile.js @@ -36,7 +36,7 @@ export class RoomMemberTile extends SimpleTile { if (!content.displayname) { return `${stateKey} removed their name (${prevContent.displayname})`; } - return `${prevContent.displayname ?? stateKey} changed their name to ${content.displayname}`; + return `${prevContent.displayname ? prevContent.displayname : stateKey} changed their name to ${content.displayname}`; } } else if (membership === "join") { return `${targetName} joined the room`; diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index f375fdd7..8af0c369 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -17,7 +17,7 @@ limitations under the License. import {createEnum} from "../utils/enum.js"; import {lookupHomeserver} from "./well-known.js"; -import {AbortableOperation} from "../utils/AbortableOperation"; +import {AbortableOperation} from "../utils/AbortableOperation.js"; import {ObservableValue} from "../observable/ObservableValue.js"; import {HomeServerApi} from "./net/HomeServerApi.js"; import {Reconnector, ConnectionStatus} from "./net/Reconnector.js"; diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index f5c42097..39cf660b 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -270,7 +270,7 @@ export class Room extends BaseRoom { _getPowerLevelsEvent(roomResponse) { const isPowerlevelEvent = event => event.state_key === "" && event.type === POWERLEVELS_EVENT_TYPE; - const powerLevelEvent = roomResponse.timeline?.events.find(isPowerlevelEvent) ?? roomResponse.state?.events.find(isPowerlevelEvent); + const powerLevelEvent = roomResponse.timeline?.events.find(isPowerlevelEvent) ? roomResponse.timeline?.events.find(isPowerlevelEvent) : roomResponse.state?.events.find(isPowerlevelEvent); return powerLevelEvent; } diff --git a/src/matrix/room/timeline/entries/BaseEntry.ts b/src/matrix/room/timeline/entries/BaseEntry.js similarity index 76% rename from src/matrix/room/timeline/entries/BaseEntry.ts rename to src/matrix/room/timeline/entries/BaseEntry.js index 1ef6a863..0c8e3cce 100644 --- a/src/matrix/room/timeline/entries/BaseEntry.ts +++ b/src/matrix/room/timeline/entries/BaseEntry.js @@ -18,21 +18,9 @@ limitations under the License. import {EventKey} from "../EventKey.js"; export const PENDING_FRAGMENT_ID = Number.MAX_SAFE_INTEGER; -interface FragmentIdComparer { - compare: (a: number, b: number) => number -} +export class BaseEntry { -export abstract class BaseEntry { - constructor( - protected readonly _fragmentIdComparer: FragmentIdComparer - ) { - } - - abstract get fragmentId(): number; - abstract get entryIndex(): number; - abstract updateFrom(other: BaseEntry): void; - - compare(otherEntry: BaseEntry): number { + compare(otherEntry) { if (this.fragmentId === otherEntry.fragmentId) { return this.entryIndex - otherEntry.entryIndex; } else if (this.fragmentId === PENDING_FRAGMENT_ID) { @@ -45,7 +33,7 @@ export abstract class BaseEntry { } } - asEventKey(): EventKey { + asEventKey() { return new EventKey(this.fragmentId, this.entryIndex); } } diff --git a/src/matrix/room/timeline/entries/BaseEventEntry.js b/src/matrix/room/timeline/entries/BaseEventEntry.js index 2869bf68..ecbacb6e 100644 --- a/src/matrix/room/timeline/entries/BaseEventEntry.js +++ b/src/matrix/room/timeline/entries/BaseEventEntry.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {BaseEntry} from "./BaseEntry"; +import {BaseEntry} from "./BaseEntry.js"; import {REDACTION_TYPE} from "../../common.js"; import {createAnnotation, ANNOTATION_RELATION_TYPE, getRelationFromContent} from "../relations.js"; import {PendingAnnotation} from "../PendingAnnotation.js"; diff --git a/src/matrix/room/timeline/entries/FragmentBoundaryEntry.js b/src/matrix/room/timeline/entries/FragmentBoundaryEntry.js index 3d4bd67b..0eb2a5b6 100644 --- a/src/matrix/room/timeline/entries/FragmentBoundaryEntry.js +++ b/src/matrix/room/timeline/entries/FragmentBoundaryEntry.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {BaseEntry} from "./BaseEntry"; +import {BaseEntry} from "./BaseEntry.js"; import {Direction} from "../Direction.js"; import {isValidFragmentId} from "../common.js"; import {KeyLimits} from "../../../storage/common.js"; diff --git a/src/matrix/room/timeline/entries/PendingEventEntry.js b/src/matrix/room/timeline/entries/PendingEventEntry.js index 4bc3c47e..742bff49 100644 --- a/src/matrix/room/timeline/entries/PendingEventEntry.js +++ b/src/matrix/room/timeline/entries/PendingEventEntry.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {PENDING_FRAGMENT_ID} from "./BaseEntry"; +import {PENDING_FRAGMENT_ID} from "./BaseEntry.js"; import {BaseEventEntry} from "./BaseEventEntry.js"; export class PendingEventEntry extends BaseEventEntry { diff --git a/src/utils/AbortableOperation.ts b/src/utils/AbortableOperation.js similarity index 77% rename from src/utils/AbortableOperation.ts rename to src/utils/AbortableOperation.js index 0cc49e10..1d91bc2c 100644 --- a/src/utils/AbortableOperation.ts +++ b/src/utils/AbortableOperation.js @@ -14,17 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -interface IAbortable { - abort(); -} - -type RunFn = (setAbortable: (a: IAbortable) => typeof a) => T; - -export class AbortableOperation { - public readonly result: T; - private _abortable: IAbortable | null; - - constructor(run: RunFn) { +export class AbortableOperation { + constructor(run) { this._abortable = null; const setAbortable = abortable => { this._abortable = abortable; diff --git a/tsconfig.json b/tsconfig.json index b7ae64e8..f4a61429 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,5 +4,7 @@ "noEmit": true, "target": "es6" }, - "include": ["src/**/*"], + "include": [ + "src/**/*" + ], } diff --git a/yarn.lock b/yarn.lock index 638e0cd0..ee956d62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1683,15 +1683,10 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -caniuse-lite@^1.0.30001111: - version "1.0.30001187" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001187.tgz" - integrity sha512-w7/EP1JRZ9552CyrThUnay2RkZ1DXxKe/Q2swTC4+LElLh9RRYrL1Z+27LlakB8kzY0fSmHw9mc7XYDUKAKWMA== - -caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001230: - version "1.0.30001231" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001231.tgz#6c1f9b49fc27cc368b894e64b9b28b39ef80603b" - integrity sha512-WAFFv31GgU4DiwNAy77qMo3nNyycEhH3ikcCVHvkQpPe/fO8Tb2aRYzss8kgyLQBm8mJ7OryW4X6Y4vsBCIqag== +caniuse-lite@^1.0.30001111, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001230: + version "1.0.30001251" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz" + integrity sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A== caseless@~0.12.0: version "0.12.0"