mirror of https://github.com/vector-im/riot-web
Only show mini avatar uploader in room intro when no avatar yet exists (#9479)
parent
fde9a527a7
commit
8ae67aa4dd
|
@ -175,14 +175,22 @@ const NewRoomIntro = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const avatarUrl = room.currentState.getStateEvents(EventType.RoomAvatar, "")?.getContent()?.url;
|
const avatarUrl = room.currentState.getStateEvents(EventType.RoomAvatar, "")?.getContent()?.url;
|
||||||
body = <React.Fragment>
|
let avatar = (
|
||||||
<MiniAvatarUploader
|
<RoomAvatar room={room} width={AVATAR_SIZE} height={AVATAR_SIZE} viewAvatarOnClick={!!avatarUrl} />
|
||||||
hasAvatar={!!avatarUrl}
|
);
|
||||||
|
|
||||||
|
if (!avatarUrl) {
|
||||||
|
avatar = <MiniAvatarUploader
|
||||||
|
hasAvatar={false}
|
||||||
noAvatarLabel={_t("Add a photo, so people can easily spot your room.")}
|
noAvatarLabel={_t("Add a photo, so people can easily spot your room.")}
|
||||||
setAvatarUrl={url => cli.sendStateEvent(roomId, EventType.RoomAvatar, { url }, '')}
|
setAvatarUrl={url => cli.sendStateEvent(roomId, EventType.RoomAvatar, { url }, '')}
|
||||||
>
|
>
|
||||||
<RoomAvatar room={room} width={AVATAR_SIZE} height={AVATAR_SIZE} viewAvatarOnClick={true} />
|
{ avatar }
|
||||||
</MiniAvatarUploader>
|
</MiniAvatarUploader>;
|
||||||
|
}
|
||||||
|
|
||||||
|
body = <React.Fragment>
|
||||||
|
{ avatar }
|
||||||
|
|
||||||
<h2>{ room.name }</h2>
|
<h2>{ room.name }</h2>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue