mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-14 13:37:15 +03:00
Display redactedBecauseUserId for redacted events
This commit is contained in:
parent
db875508d8
commit
36a69313cd
2 changed files with 12 additions and 5 deletions
|
@ -244,9 +244,17 @@ function textForServerACLEvent(ev): () => string | null {
|
||||||
function textForMessageEvent(ev: MatrixEvent): () => string | null {
|
function textForMessageEvent(ev: MatrixEvent): () => string | null {
|
||||||
return () => {
|
return () => {
|
||||||
const senderDisplayName = ev.sender && ev.sender.name ? ev.sender.name : ev.getSender();
|
const senderDisplayName = ev.sender && ev.sender.name ? ev.sender.name : ev.getSender();
|
||||||
const isRedacted = ev.isRedacted();
|
|
||||||
let message = ev.getContent().body;
|
let message = ev.getContent().body;
|
||||||
if (isRedacted) message = _t("Message Deleted");
|
if (ev.isRedacted()) {
|
||||||
|
message = _t("Message deleted");
|
||||||
|
const unsigned = ev.getUnsigned();
|
||||||
|
const redactedBecauseUserId = unsigned && unsigned.redacted_because && unsigned.redacted_because.sender;
|
||||||
|
if (redactedBecauseUserId && redactedBecauseUserId !== ev.getSender()) {
|
||||||
|
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
|
||||||
|
const sender = room && room.getMember(redactedBecauseUserId);
|
||||||
|
message = _t("Message deleted by %(name)s", { name: sender ? sender.name : redactedBecauseUserId });
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ev.getContent().msgtype === "m.emote") {
|
if (ev.getContent().msgtype === "m.emote") {
|
||||||
message = "* " + senderDisplayName + " " + message;
|
message = "* " + senderDisplayName + " " + message;
|
||||||
} else if (ev.getContent().msgtype === "m.image") {
|
} else if (ev.getContent().msgtype === "m.image") {
|
||||||
|
|
|
@ -526,7 +526,8 @@
|
||||||
"%(senderDisplayName)s set the server ACLs for this room.": "%(senderDisplayName)s set the server ACLs for this room.",
|
"%(senderDisplayName)s set the server ACLs for this room.": "%(senderDisplayName)s set the server ACLs for this room.",
|
||||||
"%(senderDisplayName)s changed the server ACLs for this room.": "%(senderDisplayName)s changed the server ACLs for this room.",
|
"%(senderDisplayName)s changed the server ACLs for this room.": "%(senderDisplayName)s changed the server ACLs for this room.",
|
||||||
"🎉 All servers are banned from participating! This room can no longer be used.": "🎉 All servers are banned from participating! This room can no longer be used.",
|
"🎉 All servers are banned from participating! This room can no longer be used.": "🎉 All servers are banned from participating! This room can no longer be used.",
|
||||||
"Message Deleted": "Message Deleted",
|
"Message deleted": "Message deleted",
|
||||||
|
"Message deleted by %(name)s": "Message deleted by %(name)s",
|
||||||
"%(senderDisplayName)s sent an image.": "%(senderDisplayName)s sent an image.",
|
"%(senderDisplayName)s sent an image.": "%(senderDisplayName)s sent an image.",
|
||||||
"%(senderDisplayName)s sent a sticker.": "%(senderDisplayName)s sent a sticker.",
|
"%(senderDisplayName)s sent a sticker.": "%(senderDisplayName)s sent a sticker.",
|
||||||
"%(senderName)s set the main address for this room to %(address)s.": "%(senderName)s set the main address for this room to %(address)s.",
|
"%(senderName)s set the main address for this room to %(address)s.": "%(senderName)s set the main address for this room to %(address)s.",
|
||||||
|
@ -1881,8 +1882,6 @@
|
||||||
"Reactions": "Reactions",
|
"Reactions": "Reactions",
|
||||||
"<reactors/><reactedWith> reacted with %(content)s</reactedWith>": "<reactors/><reactedWith> reacted with %(content)s</reactedWith>",
|
"<reactors/><reactedWith> reacted with %(content)s</reactedWith>": "<reactors/><reactedWith> reacted with %(content)s</reactedWith>",
|
||||||
"<reactors/><reactedWith>reacted with %(shortName)s</reactedWith>": "<reactors/><reactedWith>reacted with %(shortName)s</reactedWith>",
|
"<reactors/><reactedWith>reacted with %(shortName)s</reactedWith>": "<reactors/><reactedWith>reacted with %(shortName)s</reactedWith>",
|
||||||
"Message deleted": "Message deleted",
|
|
||||||
"Message deleted by %(name)s": "Message deleted by %(name)s",
|
|
||||||
"Message deleted on %(date)s": "Message deleted on %(date)s",
|
"Message deleted on %(date)s": "Message deleted on %(date)s",
|
||||||
"%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s changed the avatar for %(roomName)s",
|
"%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s changed the avatar for %(roomName)s",
|
||||||
"%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s removed the room avatar.",
|
"%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s removed the room avatar.",
|
||||||
|
|
Loading…
Reference in a new issue