Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Jan 8, 2025
1 parent 6cdfdc0 commit 13527e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
3 changes: 3 additions & 0 deletions playwright/e2e/one-to-one-chat/one-to-one-chat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ Please see LICENSE files in the repository root for full details.

import { test as base, expect } from "../../element-web-test";
import { Credentials } from "../../plugins/homeserver";
import { isDendrite } from "../../plugins/homeserver/dendrite";

const test = base.extend<{
user2?: Credentials;
}>({});

test.describe("1:1 chat room", () => {
test.skip(isDendrite, "due to a Dendrite bug https://github.com/element-hq/dendrite/issues/3492");

test.use({
displayName: "Jeff",
user2: async ({ homeserver }, use) => {
Expand Down
5 changes: 3 additions & 2 deletions src/TextForEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ function textForMemberEvent(
allowJSX: boolean,
showHiddenEvents?: boolean,
): (() => string) | null {
const senderName = getRoomMemberDisplayname(client, ev);
const targetName = getRoomMemberDisplayname(client, ev, ev.getStateKey());
// XXX: SYJS-16 "sender is sometimes null for join messages"
const senderName = ev.sender?.name || getRoomMemberDisplayname(client, ev);
const targetName = ev.target?.name || getRoomMemberDisplayname(client, ev, ev.getStateKey());
const prevContent = ev.getPrevContent();
const content = ev.getContent();
const reason = content.reason;
Expand Down
16 changes: 1 addition & 15 deletions src/components/views/messages/TextualEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/

import React from "react";
import { MatrixEvent, RoomMember, RoomMemberEvent } from "matrix-js-sdk/src/matrix";
import { MatrixEvent } from "matrix-js-sdk/src/matrix";

import RoomContext from "../../../contexts/RoomContext";
import * as TextForEvent from "../../../TextForEvent";
Expand All @@ -21,20 +21,6 @@ export default class TextualEvent extends React.Component<IProps> {
public static contextType = RoomContext;
declare public context: React.ContextType<typeof RoomContext>;

public componentDidMount(): void {
MatrixClientPeg.get()?.on(RoomMemberEvent.Name, this.onMemberNameUpdate);
}

public componentWillUnmount(): void {
MatrixClientPeg.get()?.off(RoomMemberEvent.Name, this.onMemberNameUpdate);
}

private onMemberNameUpdate = (event: MatrixEvent, member: RoomMember): void => {
if (member.userId === this.props.mxEvent.getSender() || member.userId === this.props.mxEvent.getStateKey()) {
this.forceUpdate();
}
};

public render(): React.ReactNode {
const text = TextForEvent.textForEvent(
this.props.mxEvent,
Expand Down

0 comments on commit 13527e7

Please sign in to comment.