Switch to using stable values for threads (#8019)

This commit is contained in:
Germain
2022-03-11 09:04:22 +00:00
committed by GitHub
parent d38a1fa201
commit 21d3cb08a9
12 changed files with 49 additions and 47 deletions
@@ -18,10 +18,7 @@ import React from 'react';
import { shallow, mount } from "enzyme";
import {
MatrixClient,
RelationType,
Room,
UNSTABLE_FILTER_RELATED_BY_REL_TYPES,
UNSTABLE_FILTER_RELATED_BY_SENDERS,
} from 'matrix-js-sdk/src/matrix';
import { mocked } from 'jest-mock';
import '../../skinned-sdk';
@@ -179,7 +176,7 @@ describe('ThreadPanel', () => {
const [filterKey, filter] = mocked(client).getOrCreateFilter.mock.calls[0];
expect(filterKey).toEqual(`THREAD_PANEL_${room.roomId}_${ThreadFilterType.All}`);
expect(filter.getDefinition().room.timeline).toEqual({
[UNSTABLE_FILTER_RELATED_BY_REL_TYPES.name]: [RelationType.Thread],
related_by_rel_types: ["m.thread"],
});
});
@@ -189,8 +186,8 @@ describe('ThreadPanel', () => {
const [filterKey, filter] = mocked(client).getOrCreateFilter.mock.calls[0];
expect(filterKey).toEqual(`THREAD_PANEL_${room.roomId}_${ThreadFilterType.My}`);
expect(filter.getDefinition().room.timeline).toEqual({
[UNSTABLE_FILTER_RELATED_BY_REL_TYPES.name]: [RelationType.Thread],
[UNSTABLE_FILTER_RELATED_BY_SENDERS.name]: [aliceId],
related_by_rel_types: ["m.thread"],
related_by_senders: [aliceId],
});
});
});
@@ -18,7 +18,6 @@ import React from "react";
import { act } from "react-dom/test-utils";
import { sleep } from "matrix-js-sdk/src/utils";
import { mount } from 'enzyme';
import { RelationType } from 'matrix-js-sdk/src/@types/event';
import '../../../skinned-sdk'; // Must be first for skinning to work
import SendMessageComposer, {
@@ -298,7 +297,7 @@ describe('<SendMessageComposer/>', () => {
placeholder=""
permalinkCreator={new MatrixToPermalinkConstructor() as any}
relation={{
rel_type: RelationType.Thread,
rel_type: "m.thread",
event_id: "myFakeThreadId",
}}
includeReplyLegacyFallback={false}
+3 -3
View File
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { MatrixClient, MatrixEvent, RelationType, Room } from "matrix-js-sdk/src/matrix";
import { MatrixClient, MatrixEvent, Room } from "matrix-js-sdk/src/matrix";
import { Thread } from "matrix-js-sdk/src/models/thread";
import { mkMessage, MessageEventProps } from "./test-utils";
@@ -25,7 +25,7 @@ export const makeThreadEvent = ({ rootEventId, replyToEventId, ...props }: Messa
...props,
relatesTo: {
event_id: rootEventId,
rel_type: RelationType.Thread,
rel_type: "m.thread",
['m.in_reply_to']: {
event_id: replyToEventId,
},
@@ -79,7 +79,7 @@ export const makeThreadEvents = ({
rootEvent.setUnsigned({
"m.relations": {
[RelationType.Thread]: {
"m.thread": {
latest_event: events[events.length - 1],
count: length,
current_user_participated: [...participantUserIds, authorId].includes(currentUserId),