Hide the invite button in non-public rooms
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
|
||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||
|
||||
export const useRoomAvatar = (room: Room) => {
|
||||
const [avatarUrl, setAvatarUrl] = useState(room.getMxcAvatarUrl());
|
||||
|
||||
useEffect(() => {
|
||||
const update = (ev: MatrixEvent) => {
|
||||
if (ev.getType() === EventType.RoomAvatar) {
|
||||
setAvatarUrl(room.getMxcAvatarUrl());
|
||||
}
|
||||
};
|
||||
|
||||
room.currentState.on(RoomStateEvent.Events, update);
|
||||
return () => {
|
||||
room.currentState.off(RoomStateEvent.Events, update);
|
||||
};
|
||||
}, [room]);
|
||||
|
||||
return avatarUrl;
|
||||
};
|
||||
Reference in New Issue
Block a user