Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lobby-notifications): Prevent lobby notification to remain on scr… #11054

Merged
merged 3 commits into from
Mar 1, 2022

Conversation

tudor-phd
Copy link
Contributor

…een.

Copy link
Member

@saghul saghul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments, PTAL!

dispatch(rejectKnockingParticipant(firstParticipant.id));
}) ];
}
if (knockingParticipants.length === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this up? Otherwise the code will first create a notification that will never be used. We can check this the first thing and return early.

let icon;

const knockingParticipants = getKnockingParticipants(getState());
const firstParticipant = knockingParticipants[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this constant to the branch where its actually used please.

dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
dispatch(openParticipantsPane());
}) ];
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are here, please let's reverse the logic. Check if length === 1, and do the other part in the else.

dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
dispatch(rejectKnockingParticipant(firstParticipant.id));
}) ];
} else if (knockingParticipants.length > 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this an else pl


if (knockingParticipants.length === 0) {
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just return in the if branch, to avoid a large else.

customActionHandler,
icon
}, NOTIFICATION_TIMEOUT_TYPE.STICKY));
_handleLobbyNotification({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: leave a newline for for extra breathing room :-)

@saghul
Copy link
Member

saghul commented Mar 1, 2022

Perfect!

@saghul saghul merged commit 5d68a53 into jitsi:master Mar 1, 2022
ankit-programmer pushed a commit to ankit-programmer/jitsi-meet that referenced this pull request May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants