remove isPresenter methods from services

This commit is contained in:
Ramón Souza 2021-11-23 16:40:14 +00:00
parent 19e2891023
commit 51b5cc4f3a
5 changed files with 4 additions and 31 deletions

View File

@ -1,8 +1,6 @@
import Presentations from '/imports/api/presentations'; import Presentations from '/imports/api/presentations';
import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service'; import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service';
import { getVideoUrl } from '/imports/ui/components/external-video-player/service'; import { getVideoUrl } from '/imports/ui/components/external-video-player/service';
import Auth from '/imports/ui/services/auth';
import Users from '/imports/api/users';
import Settings from '/imports/ui/services/settings'; import Settings from '/imports/ui/services/settings';
import getFromUserSettings from '/imports/ui/services/users-settings'; import getFromUserSettings from '/imports/ui/services/users-settings';
import { ACTIONS } from '../layout/enums'; import { ACTIONS } from '../layout/enums';
@ -21,9 +19,6 @@ const getPresentationInfo = () => {
}; };
}; };
const isUserPresenter = () => Users.findOne({ userId: Auth.userID },
{ fields: { presenter: 1 } }).presenter;
function shouldShowWhiteboard() { function shouldShowWhiteboard() {
return true; return true;
} }
@ -91,7 +86,6 @@ export default {
shouldShowScreenshare, shouldShowScreenshare,
shouldShowExternalVideo, shouldShowExternalVideo,
shouldShowOverlay, shouldShowOverlay,
isUserPresenter,
isVideoBroadcasting, isVideoBroadcasting,
toggleSwapLayout, toggleSwapLayout,
shouldEnableSwapLayout, shouldEnableSwapLayout,

View File

@ -1,4 +1,3 @@
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
import { CurrentPoll } from '/imports/api/polls'; import { CurrentPoll } from '/imports/api/polls';
import caseInsensitiveReducer from '/imports/utils/caseInsensitiveReducer'; import caseInsensitiveReducer from '/imports/utils/caseInsensitiveReducer';
@ -212,10 +211,6 @@ const checkPollType = (
}; };
export default { export default {
amIPresenter: () => Users.findOne(
{ userId: Auth.userID },
{ fields: { presenter: 1 } },
).presenter,
pollTypes, pollTypes,
currentPoll: () => CurrentPoll.findOne({ meetingId: Auth.meetingID }), currentPoll: () => CurrentPoll.findOne({ meetingId: Auth.meetingID }),
pollAnswerIds, pollAnswerIds,

View File

@ -1,7 +1,5 @@
import PresentationPods from '/imports/api/presentation-pods';
import Presentations from '/imports/api/presentations'; import Presentations from '/imports/api/presentations';
import { Slides, SlidePositions } from '/imports/api/slides'; import { Slides, SlidePositions } from '/imports/api/slides';
import Auth from '/imports/ui/services/auth';
import PollService from '/imports/ui/components/poll/service'; import PollService from '/imports/ui/components/poll/service';
const POLL_SETTINGS = Meteor.settings.public.poll; const POLL_SETTINGS = Meteor.settings.public.poll;
@ -169,19 +167,9 @@ const parseCurrentSlideContent = (yesValue, noValue, abstentionValue, trueValue,
}; };
}; };
const isPresenter = (podId) => {
const selector = {
meetingId: Auth.meetingID,
podId,
};
const pod = PresentationPods.findOne(selector);
return pod?.currentPresenterId === Auth.userID;
};
export default { export default {
getCurrentSlide, getCurrentSlide,
getSlidePosition, getSlidePosition,
isPresenter,
isPresentationDownloadable, isPresentationDownloadable,
downloadPresentationUri, downloadPresentationUri,
currentSlidHasContent, currentSlidHasContent,

View File

@ -6,7 +6,6 @@ import logger from '/imports/startup/client/logger';
import { stopWatching } from '/imports/ui/components/external-video-player/service'; import { stopWatching } from '/imports/ui/components/external-video-player/service';
import Meetings from '/imports/api/meetings'; import Meetings from '/imports/api/meetings';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
import UserListService from '/imports/ui/components/user-list/service';
import AudioService from '/imports/ui/components/audio/service'; import AudioService from '/imports/ui/components/audio/service';
import { Meteor } from "meteor/meteor"; import { Meteor } from "meteor/meteor";
import MediaStreamUtils from '/imports/utils/media-stream-utils'; import MediaStreamUtils from '/imports/utils/media-stream-utils';
@ -97,14 +96,14 @@ const attachLocalPreviewStream = (mediaElement) => {
} }
} }
const screenshareHasStarted = () => { const screenshareHasStarted = (isPresenter) => {
// Presenter's screen preview is local, so skip // Presenter's screen preview is local, so skip
if (!UserListService.amIPresenter()) { if (!isPresenter) {
viewScreenshare(); viewScreenshare();
} }
}; };
const shareScreen = async (onFail) => { const shareScreen = async (isPresenter, onFail) => {
// stop external video share if running // stop external video share if running
const meeting = Meetings.findOne({ meetingId: Auth.meetingID }); const meeting = Meetings.findOne({ meetingId: Auth.meetingID });
@ -114,7 +113,7 @@ const shareScreen = async (onFail) => {
try { try {
const stream = await BridgeService.getScreenStream(); const stream = await BridgeService.getScreenStream();
if(!UserListService.isUserPresenter(Auth.userID)) return MediaStreamUtils.stopMediaStreamTracks(stream); if(!isPresenter) return MediaStreamUtils.stopMediaStreamTracks(stream);
await KurentoBridge.share(stream, onFail); await KurentoBridge.share(stream, onFail);
setSharingScreen(true); setSharingScreen(true);
} catch (error) { } catch (error) {

View File

@ -595,8 +595,6 @@ const isUserPresenter = (userId) => {
return user ? user.presenter : false; return user ? user.presenter : false;
}; };
const amIPresenter = () => isUserPresenter(Auth.userID);
export const getUserNamesLink = (docTitle, fnSortedLabel, lnSortedLabel) => { export const getUserNamesLink = (docTitle, fnSortedLabel, lnSortedLabel) => {
const mimeType = 'text/plain'; const mimeType = 'text/plain';
const userNamesObj = getUsers() const userNamesObj = getUsers()
@ -666,7 +664,6 @@ export default {
requestUserInformation, requestUserInformation,
focusFirstDropDownItem, focusFirstDropDownItem,
isUserPresenter, isUserPresenter,
amIPresenter,
getUsersProp, getUsersProp,
getUserCount, getUserCount,
sortUsersByCurrent, sortUsersByCurrent,