forked from mystiq/hydrogen-web
Misc. hacks to remove ts
This commit is contained in:
parent
25d0cbe9a2
commit
0b4797d9cf
10 changed files with 18 additions and 42 deletions
|
@ -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`;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -14,17 +14,8 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
interface IAbortable {
|
||||
abort();
|
||||
}
|
||||
|
||||
type RunFn<T> = (setAbortable: (a: IAbortable) => typeof a) => T;
|
||||
|
||||
export class AbortableOperation<T> {
|
||||
public readonly result: T;
|
||||
private _abortable: IAbortable | null;
|
||||
|
||||
constructor(run: RunFn<T>) {
|
||||
export class AbortableOperation {
|
||||
constructor(run) {
|
||||
this._abortable = null;
|
||||
const setAbortable = abortable => {
|
||||
this._abortable = abortable;
|
|
@ -4,5 +4,7 @@
|
|||
"noEmit": true,
|
||||
"target": "es6"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
}
|
||||
|
|
13
yarn.lock
13
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"
|
||||
|
|
Loading…
Reference in a new issue