mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-05 00:39:07 +03:00
null-guards
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
a5830c229e
commit
3e35cffae7
1 changed files with 3 additions and 2 deletions
|
@ -28,8 +28,9 @@ const RedactedBody = React.forwardRef<any, IProps>(({mxEvent}, ref) => {
|
|||
const cli: MatrixClient = useContext(MatrixClientContext);
|
||||
|
||||
let text = _t("Message deleted");
|
||||
const redactedBecauseUserId = mxEvent.getUnsigned().redacted_because.sender;
|
||||
if (redactedBecauseUserId && redactedBecauseUserId !== cli.getUserId()) {
|
||||
const unsigned = mxEvent.getUnsigned();
|
||||
const redactedBecauseUserId = unsigned && unsigned.redacted_because && unsigned.redacted_because.sender;
|
||||
if (redactedBecauseUserId && redactedBecauseUserId !== mxEvent.getSender()) {
|
||||
const room = cli.getRoom(mxEvent.getRoomId());
|
||||
const sender = room && room.getMember(redactedBecauseUserId);
|
||||
text = _t("Message deleted by %(name)s", { name: sender ? sender.name : redactedBecauseUserId });
|
||||
|
|
Loading…
Reference in a new issue