Use MatrixClientPeg::safeGet in src/{stores,hooks,components/structures}/* (#10988)
This commit is contained in:
parent
707fd9ccf0
commit
dd46db4817
34 changed files with 139 additions and 130 deletions
|
@ -291,7 +291,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
|||
if (!this.state.contextMenuPosition) return null;
|
||||
|
||||
let topSection: JSX.Element | undefined;
|
||||
if (MatrixClientPeg.get().isGuest()) {
|
||||
if (MatrixClientPeg.safeGet().isGuest()) {
|
||||
topSection = (
|
||||
<div className="mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts">
|
||||
{_t(
|
||||
|
@ -372,7 +372,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
|||
</IconizedContextMenuOptionList>
|
||||
);
|
||||
|
||||
if (MatrixClientPeg.get().isGuest()) {
|
||||
if (MatrixClientPeg.safeGet().isGuest()) {
|
||||
primaryOptionList = (
|
||||
<IconizedContextMenuOptionList>
|
||||
{homeButton}
|
||||
|
@ -399,7 +399,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
|||
</span>
|
||||
<span className="mx_UserMenu_contextMenu_userId">
|
||||
{UserIdentifierCustomisations.getDisplayUserIdentifier(
|
||||
MatrixClientPeg.get().getSafeUserId(),
|
||||
MatrixClientPeg.safeGet().getSafeUserId(),
|
||||
{
|
||||
withDisplayName: true,
|
||||
},
|
||||
|
@ -428,7 +428,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
|||
public render(): React.ReactNode {
|
||||
const avatarSize = 32; // should match border-radius of the avatar
|
||||
|
||||
const userId = MatrixClientPeg.get().getSafeUserId();
|
||||
const userId = MatrixClientPeg.safeGet().getSafeUserId();
|
||||
const displayName = OwnProfileStore.instance.displayName || userId;
|
||||
const avatarUrl = OwnProfileStore.instance.getHttpAvatarUrl(avatarSize);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue