Merge pull request #12410 from ramonlsouza/fix-useless-conditional-alerts

refactor: remove useless conditionals
This commit is contained in:
Anton Georgiev 2021-05-19 10:16:06 -04:00 committed by GitHub
commit b03da339ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 34 deletions

View File

@ -65,33 +65,31 @@ export default function handleValidateAuthToken({ body }, meetingId) {
return;
}
if (valid) {
// Define user ID on connections
pendingAuths.forEach(
(pendingAuth) => {
const { methodInvocationObject } = pendingAuth;
// Define user ID on connections
pendingAuths.forEach(
(pendingAuth) => {
const { methodInvocationObject } = pendingAuth;
/* Logic migrated from validateAuthToken method ( postponed to only run in case of success response ) - Begin */
const sessionId = `${meetingId}--${userId}`;
/* Logic migrated from validateAuthToken method ( postponed to only run in case of success response ) - Begin */
const sessionId = `${meetingId}--${userId}`;
methodInvocationObject.setUserId(sessionId);
methodInvocationObject.setUserId(sessionId);
const User = Users.findOne({
meetingId,
userId,
});
const User = Users.findOne({
meetingId,
userId,
});
if (!User) {
createDummyUser(meetingId, userId, authToken);
}
if (!User) {
createDummyUser(meetingId, userId, authToken);
}
ClientConnections.add(sessionId, methodInvocationObject.connection);
upsertValidationState(meetingId, userId, ValidationStates.VALIDATED, methodInvocationObject.connection.id);
ClientConnections.add(sessionId, methodInvocationObject.connection);
upsertValidationState(meetingId, userId, ValidationStates.VALIDATED, methodInvocationObject.connection.id);
/* End of logic migrated from validateAuthToken */
},
);
}
/* End of logic migrated from validateAuthToken */
},
);
const selector = {
meetingId,
@ -105,7 +103,7 @@ export default function handleValidateAuthToken({ body }, meetingId) {
if (!User) return;
// Publish user join message
if (valid && !waitForApproval) {
if (!waitForApproval) {
Logger.info('User=', User);
userJoin(meetingId, userId, User.authToken);
}
@ -124,11 +122,9 @@ export default function handleValidateAuthToken({ body }, meetingId) {
const numberAffected = Users.update(selector, modifier);
if (numberAffected) {
if (valid) {
const sessionUserId = `${meetingId}-${userId}`;
const currentConnectionId = User.connectionId ? User.connectionId : false;
clearOtherSessions(sessionUserId, currentConnectionId);
}
const sessionUserId = `${meetingId}-${userId}`;
const currentConnectionId = User.connectionId ? User.connectionId : false;
clearOtherSessions(sessionUserId, currentConnectionId);
Logger.info(`Validated auth token as ${valid} user=${userId} meeting=${meetingId}`);
} else {

View File

@ -176,7 +176,7 @@ class Base extends Component {
// In case the meeting delayed to load
if (!subscriptionsReady || !meetingExist) return;
if (approved && loading && subscriptionsReady) this.updateLoadingState(false);
if (approved && loading) this.updateLoadingState(false);
if (prevProps.ejected || ejected) {
Session.set('codeError', '403');

View File

@ -104,7 +104,7 @@ class MessageChatItem extends PureComponent {
return;
}
if (isElementInViewport(node) && !read) {
if (isElementInViewport(node)) {
handleReadMessage(time);
this.removeScrollListeners();
}

View File

@ -73,10 +73,6 @@ const UserName = (props) => {
const userNameSub = [];
if (compact) {
return null;
}
if (isThisMeetingLocked && user.locked && user.role !== ROLE_MODERATOR) {
userNameSub.push(
<span>

View File

@ -521,7 +521,7 @@ class WhiteboardToolbar extends Component {
customIcon={false}
label="Annotations"
onItemClick={this.handleAnnotationChange}
objectsToRender={panMode ? annotations[annotations.length - 1] : annotations}
objectsToRender={annotations}
objectSelected={annotationSelected}
handleMouseEnter={this.handleMouseEnter}
handleMouseLeave={this.handleMouseLeave}