Merge pull request #19957 from JoVictorNunes/fix-conn-status-session-logs-30

fix(connection status): restore session logs tab
This commit is contained in:
Ramón Souza 2024-04-04 13:28:09 -03:00 committed by GitHub
commit 88b31db097
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 21 deletions

View File

@ -525,6 +525,7 @@ class ConnectionStatusComponent extends PureComponent {
setModalIsOpen,
intl,
isModalOpen,
amIModerator,
} = this.props;
const { selectedTab } = this.state;
@ -557,7 +558,7 @@ class ConnectionStatusComponent extends PureComponent {
<Styled.ConnectionTabSelector selectedClassName="is-selected">
<span id="my-logs-tab">{intl.formatMessage(intlMessages.myLogs)}</span>
</Styled.ConnectionTabSelector>
{Service.isModerator()
{amIModerator
&& (
<Styled.ConnectionTabSelector selectedClassName="is-selected">
<span id="session-logs-tab">{intl.formatMessage(intlMessages.sessionLogs)}</span>
@ -574,7 +575,7 @@ class ConnectionStatusComponent extends PureComponent {
<Styled.ConnectionTabPanel selectedClassName="is-selected">
<ul>{this.renderConnections()}</ul>
</Styled.ConnectionTabPanel>
{Service.isModerator()
{amIModerator
&& (
<Styled.ConnectionTabPanel selectedClassName="is-selected">
<ul>{this.renderConnections()}</ul>

View File

@ -3,13 +3,17 @@ import { useSubscription } from '@apollo/client';
import { CONNECTION_STATUS_REPORT_SUBSCRIPTION } from '../queries';
import Service from '../service';
import Component from './component';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
const ConnectionStatusContainer = (props) => {
const { data } = useSubscription(CONNECTION_STATUS_REPORT_SUBSCRIPTION);
const connectionData = data ? Service.sortConnectionData(data.user_connectionStatusReport) : [];
const { data: currentUser } = useCurrentUser((u) => ({ isModerator: u.isModerator }));
const amIModerator = !!currentUser?.isModerator;
return (
<Component
connectionData={connectionData}
amIModerator={amIModerator}
{...props}
/>
);

View File

@ -1,5 +1,4 @@
import { defineMessages } from 'react-intl';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import { Session } from 'meteor/session';
import { notify } from '/imports/ui/services/notification';
@ -9,7 +8,6 @@ import ScreenshareService from '/imports/ui/components/screenshare/service';
const STATS = window.meetingClientSettings.public.stats;
const NOTIFICATION = STATS.notification;
const ROLE_MODERATOR = window.meetingClientSettings.public.user.role_moderator;
const intlMessages = defineMessages({
saved: {
@ -89,22 +87,6 @@ const sortOnline = (a, b) => {
const isEnabled = () => STATS.enabled;
const isModerator = () => {
const user = Users.findOne(
{
meetingId: Auth.meetingID,
userId: Auth.userID,
},
{ fields: { role: 1 } },
);
if (user && user.role === ROLE_MODERATOR) {
return true;
}
return false;
};
if (STATS.enabled) {
window.addEventListener('audiostats', handleAudioStatsEvent);
}
@ -393,7 +375,6 @@ const calculateBitsPerSecondFromMultipleData = (currentData, previousData) => {
const sortConnectionData = (connectionData) => connectionData.sort(sortLevel).sort(sortOnline);
export default {
isModerator,
getStats,
getHelp,
isEnabled,