diff --git a/src/components/views/right_panel/PinnedMessagesCard.tsx b/src/components/views/right_panel/PinnedMessagesCard.tsx index 31fcc27266..7e4bc3a7ae 100644 --- a/src/components/views/right_panel/PinnedMessagesCard.tsx +++ b/src/components/views/right_panel/PinnedMessagesCard.tsx @@ -108,6 +108,8 @@ const PinnedMessagesCard = ({ room, onClose }: IProps) => { await cli.decryptEventIfNeeded(event); // TODO await? } if (event && PinningUtils.isPinnable(event)) { + // Inject sender information + event.sender = room.getMember(event.getSender()); return event; } } catch (err) { @@ -140,7 +142,6 @@ const PinnedMessagesCard = ({ room, onClose }: IProps) => { content = pinnedEvents.filter(Boolean).reverse().map(ev => ( onUnpinClicked(ev) : undefined} /> diff --git a/src/components/views/rooms/PinnedEventTile.tsx b/src/components/views/rooms/PinnedEventTile.tsx index 91ad97236a..7163b27c3f 100644 --- a/src/components/views/rooms/PinnedEventTile.tsx +++ b/src/components/views/rooms/PinnedEventTile.tsx @@ -16,7 +16,6 @@ limitations under the License. */ import React from "react"; -import { Room } from "matrix-js-sdk/src/models/room"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import dis from "../../../dispatcher/dispatcher"; @@ -33,7 +32,6 @@ import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload"; interface IProps { - room: Room; event: MatrixEvent; onUnpinClicked?(): void; } @@ -56,7 +54,6 @@ export default class PinnedEventTile extends React.Component { render() { const sender = this.props.event.getSender(); - const senderProfile = this.props.room.getMember(sender); let unpinButton = null; if (this.props.onUnpinClicked) { @@ -72,14 +69,14 @@ export default class PinnedEventTile extends React.Component { return
- { senderProfile?.name || sender } + { this.props.event.sender?.name || sender } { unpinButton }