mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Fix to show item id only if is moderator
This commit is contained in:
parent
be92aede93
commit
1a3b9154a1
@ -7,16 +7,23 @@ export class RoomWidgetChooserContentEvent extends RoomWidgetUpdateEvent
|
||||
public static FURNI_CHOOSER_CONTENT: string = 'RWCCE_FURNI_CHOOSER_CONTENT';
|
||||
|
||||
private _items: RoomObjectItem[];
|
||||
private _isModerator: boolean;
|
||||
|
||||
constructor(type: string, items: RoomObjectItem[])
|
||||
constructor(type: string, items: RoomObjectItem[], isModerator: boolean = false)
|
||||
{
|
||||
super(type);
|
||||
|
||||
this._items = items;
|
||||
this._isModerator = isModerator;
|
||||
}
|
||||
|
||||
public get items(): RoomObjectItem[]
|
||||
{
|
||||
return this._items;
|
||||
}
|
||||
|
||||
public get isModerator(): boolean
|
||||
{
|
||||
return this._isModerator;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ export class FurniChooserWidgetHandler extends RoomWidgetHandler
|
||||
return (a.name < b.name) ? -1 : 1;
|
||||
});
|
||||
|
||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChooserContentEvent(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, items));
|
||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChooserContentEvent(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, items, GetSessionDataManager().isModerator));
|
||||
}
|
||||
|
||||
private selectRoomObject(message: RoomWidgetRoomObjectMessage): void
|
||||
|
@ -8,6 +8,7 @@ export const FurniChooserWidgetView: FC<{}> = props =>
|
||||
{
|
||||
const [ isVisible, setIsVisible ] = useState(false);
|
||||
const [ items, setItems ] = useState<RoomObjectItem[]>(null);
|
||||
const [ isModerator, setIsmModerator ] = useState<boolean>(false);
|
||||
const [ refreshTimeout, setRefreshTimeout ] = useState<ReturnType<typeof setTimeout>>(null);
|
||||
const { eventDispatcher = null, widgetHandler = null } = useRoomContext();
|
||||
|
||||
@ -28,6 +29,7 @@ export const FurniChooserWidgetView: FC<{}> = props =>
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setItems(event.items);
|
||||
setIsmModerator(event.isModerator);
|
||||
setIsVisible(true);
|
||||
});
|
||||
}, []);
|
||||
@ -61,5 +63,5 @@ export const FurniChooserWidgetView: FC<{}> = props =>
|
||||
|
||||
if(!items) return null;
|
||||
|
||||
return <ChooserWidgetView title={ LocalizeText('widget.chooser.furni.title') } displayItemId={ true } items={ items } onCloseClick={ close } />;
|
||||
return <ChooserWidgetView title={ LocalizeText('widget.chooser.furni.title') } displayItemId={ isModerator } items={ items } onCloseClick={ close } />;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user