mirror of
https://github.com/lux-tel/session-desktop.git
synced 2026-10-30 20:33:24 +00:00
19 lines
626 B
TypeScript
19 lines
626 B
TypeScript
import { getAppDispatch } from '../../state/dispatch';
|
|
import { useIsPublic, useWeAreAdmin } from '../../hooks/useParamSelector';
|
|
import { updateAddModeratorsModal } from '../../state/ducks/modalDialog';
|
|
|
|
export function useAddModeratorsCb(conversationId: string) {
|
|
const dispatch = getAppDispatch();
|
|
const isPublic = useIsPublic(conversationId);
|
|
const weAreAdmin = useWeAreAdmin(conversationId);
|
|
// only an admin can add moderators from a community. Another moderator cannot.
|
|
|
|
if (!isPublic || !weAreAdmin) {
|
|
return null;
|
|
}
|
|
|
|
return () => {
|
|
dispatch(updateAddModeratorsModal({ conversationId }));
|
|
};
|
|
}
|