Use updates stable relations from js-sdk (#8715)

* Use updates stable relations from js-sdk

* Relations is now accessible on the Room instead

* Reuse more existing code and ditch confusing `isThreadRelation`

* Fix last usage of removed `isThreadRelation`

* Update tests to match removal of isThreadRelation

* Tweak method naming to closer match spec

* Fix missing method name change
This commit is contained in:
Michael Telatynski 2022-06-07 11:16:54 +01:00 committed by GitHub
parent 56b0b79fb7
commit 21d0aaf524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 54 deletions

View file

@ -21,6 +21,7 @@ import { logger } from 'matrix-js-sdk/src/logger';
import { M_POLL_START } from "matrix-events-sdk";
import { M_LOCATION } from "matrix-js-sdk/src/@types/location";
import { M_BEACON_INFO } from 'matrix-js-sdk/src/@types/beacon';
import { THREAD_RELATION_TYPE } from 'matrix-js-sdk/src/models/thread';
import { MatrixClientPeg } from '../MatrixClientPeg';
import shouldHideEvent from "../shouldHideEvent";
@ -231,7 +232,10 @@ export async function fetchInitialEvent(
initialEvent = null;
}
if (initialEvent?.isThreadRelation && client.supportsExperimentalThreads() && !initialEvent.getThread()) {
if (client.supportsExperimentalThreads() &&
initialEvent?.isRelation(THREAD_RELATION_TYPE.name) &&
!initialEvent.getThread()
) {
const threadId = initialEvent.threadRootId;
const room = client.getRoom(roomId);
try {