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 { isVideoBroadcasting } from '/imports/ui/components/screenshare/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 getFromUserSettings from '/imports/ui/services/users-settings';
import { ACTIONS } from '../layout/enums';
@ -21,9 +19,6 @@ const getPresentationInfo = () => {
};
};
const isUserPresenter = () => Users.findOne({ userId: Auth.userID },
{ fields: { presenter: 1 } }).presenter;
function shouldShowWhiteboard() {
return true;
}
@ -91,7 +86,6 @@ export default {
shouldShowScreenshare,
shouldShowExternalVideo,
shouldShowOverlay,
isUserPresenter,
isVideoBroadcasting,
toggleSwapLayout,
shouldEnableSwapLayout,

View File

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

View File

@ -1,7 +1,5 @@
import PresentationPods from '/imports/api/presentation-pods';
import Presentations from '/imports/api/presentations';
import { Slides, SlidePositions } from '/imports/api/slides';
import Auth from '/imports/ui/services/auth';
import PollService from '/imports/ui/components/poll/service';
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 {
getCurrentSlide,
getSlidePosition,
isPresenter,
isPresentationDownloadable,
downloadPresentationUri,
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 Meetings from '/imports/api/meetings';
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 { Meteor } from "meteor/meteor";
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
if (!UserListService.amIPresenter()) {
if (!isPresenter) {
viewScreenshare();
}
};
const shareScreen = async (onFail) => {
const shareScreen = async (isPresenter, onFail) => {
// stop external video share if running
const meeting = Meetings.findOne({ meetingId: Auth.meetingID });
@ -114,7 +113,7 @@ const shareScreen = async (onFail) => {
try {
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);
setSharingScreen(true);
} catch (error) {

View File

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