Add labs flag: Show only current profile on historical messages (#7815)
* Add labs flag: Show only current profile on historical messages For https://github.com/vector-im/element-web/issues/3768 Related https://github.com/vector-im/element-web/issues/4677 * Use the member's user ID
This commit is contained in:
parent
acd051db43
commit
34567b9aab
5 changed files with 39 additions and 10 deletions
|
@ -25,6 +25,8 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
|||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
import UserIdentifier from '../../../customisations/UserIdentifier';
|
||||
import { TileShape } from '../rooms/EventTile';
|
||||
import SettingsStore from "../../../settings/SettingsStore";
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
|
||||
interface IProps {
|
||||
mxEvent: MatrixEvent;
|
||||
|
@ -107,9 +109,17 @@ export default class SenderProfile extends React.Component<IProps, IState> {
|
|||
const colorClass = getUserNameColorClass(mxEvent.getSender());
|
||||
const { msgtype } = mxEvent.getContent();
|
||||
|
||||
const disambiguate = mxEvent.sender?.disambiguate;
|
||||
const displayName = mxEvent.sender?.rawDisplayName || mxEvent.getSender() || "";
|
||||
const mxid = mxEvent.sender?.userId || mxEvent.getSender() || "";
|
||||
let member = mxEvent.sender;
|
||||
if (SettingsStore.getValue("feature_use_only_current_profiles")) {
|
||||
const room = MatrixClientPeg.get().getRoom(mxEvent.getRoomId());
|
||||
if (room) {
|
||||
member = room.getMember(member.userId);
|
||||
}
|
||||
}
|
||||
|
||||
const disambiguate = member?.disambiguate || mxEvent.sender?.disambiguate;
|
||||
const displayName = member?.rawDisplayName || mxEvent.getSender() || "";
|
||||
const mxid = member?.userId || mxEvent.getSender() || "";
|
||||
|
||||
if (msgtype === MsgType.Emote && this.props.tileShape !== TileShape.ThreadPanel) {
|
||||
return null; // emote message must include the name so don't duplicate it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue