mirror of
https://github.com/vector-im/element-web.git
synced 2025-10-01 18:41:05 +02:00
Fix mini avatar uploader "working" even without permissions
This commit is contained in:
parent
777c0ca1ef
commit
f4190ccae2
@ -15,6 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {useContext, useRef, useState} from 'react';
|
import React, {useContext, useRef, useState} from 'react';
|
||||||
|
import {EventType} from 'matrix-js-sdk/src/@types/event';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import AccessibleButton from "./AccessibleButton";
|
import AccessibleButton from "./AccessibleButton";
|
||||||
@ -23,6 +24,7 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
|||||||
import {useTimeout} from "../../../hooks/useTimeout";
|
import {useTimeout} from "../../../hooks/useTimeout";
|
||||||
import Analytics from "../../../Analytics";
|
import Analytics from "../../../Analytics";
|
||||||
import CountlyAnalytics from '../../../CountlyAnalytics';
|
import CountlyAnalytics from '../../../CountlyAnalytics';
|
||||||
|
import RoomContext from "../../../contexts/RoomContext";
|
||||||
|
|
||||||
export const AVATAR_SIZE = 52;
|
export const AVATAR_SIZE = 52;
|
||||||
|
|
||||||
@ -50,6 +52,10 @@ const MiniAvatarUploader: React.FC<IProps> = ({ hasAvatar, hasAvatarLabel, noAva
|
|||||||
|
|
||||||
const label = (hasAvatar || busy) ? hasAvatarLabel : noAvatarLabel;
|
const label = (hasAvatar || busy) ? hasAvatarLabel : noAvatarLabel;
|
||||||
|
|
||||||
|
const {room} = useContext(RoomContext);
|
||||||
|
const canSetAvatar = room?.currentState.maySendStateEvent(EventType.RoomAvatar, cli.getUserId());
|
||||||
|
if (!canSetAvatar) return children;
|
||||||
|
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user