Skip to content

Commit

Permalink
Greenlight version number only appears for admins (#5893)
Browse files Browse the repository at this point in the history
* Greenlight version number only appears for admins

- Changes to App.jsx: passed in currentUser to the Footer
- Footer renders the version number if the current user is an admin

* - currentUser is no longer passed as a prop to the Footer component.
  Footer component imports useAuth to get the current user
  • Loading branch information
alihadimazeh authored Jul 25, 2024
1 parent 71b8e9b commit 994ab7b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/javascript/components/shared_components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ import { useTranslation } from 'react-i18next';
import { Container } from 'react-bootstrap';
import useEnv from '../../hooks/queries/env/useEnv';
import useSiteSetting from '../../hooks/queries/site_settings/useSiteSetting';
import { useAuth } from '../../contexts/auth/AuthProvider';

export default function Footer() {
const { t } = useTranslation();
const { data: env } = useEnv();
const { data: links } = useSiteSetting(['Terms', 'PrivacyPolicy']);
const currentUser = useAuth();
const isAdmin = currentUser && currentUser.role && currentUser?.role.name === 'Administrator';

return (
<footer id="footer" className="footer background-whitesmoke text-center">
<Container id="footer-container" className="py-3">
<a href="https://docs.bigbluebutton.org/greenlight/v3/install" target="_blank" rel="noreferrer">Greenlight</a>
<span className="text-muted"> {env?.VERSION_TAG} </span>
{ isAdmin && <span className="text-muted"> {env?.VERSION_TAG} </span> }
{ links?.Terms
&& (
<a className="ps-3" href={links?.Terms} target="_blank" rel="noreferrer">
Expand Down

0 comments on commit 994ab7b

Please sign in to comment.