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

Stop refreshing participant list when a guest is chatting #866

Conversation

nickvergessen
Copy link
Member

Fix #865

Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen added 3. to review bug feature: chat 💬 Chat and system messages feature: signaling 📶 Internal and external signaling backends labels May 8, 2018
@nickvergessen nickvergessen added this to the 4.0 (Nextcloud 14) milestone May 8, 2018
@nickvergessen nickvergessen requested a review from Ivansss May 8, 2018 11:09
Copy link
Member

@fancycode fancycode left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this, found two issues.

->set('display_name', $query->createNamedParameter($displayName))
->where($query->expr()->eq('session_hash', $query->createNamedParameter($sessionHash)));
$query->execute();
$dispatchEvent = true;
Copy link
Member

Choose a reason for hiding this comment

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

This is never set to false.

Copy link
Member Author

Choose a reason for hiding this comment

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

right, changed the logic of the code and broke this.

$dispatchEvent = true;
}
} catch (ParticipantNotFoundException $e) {
$this->connection->insertIfNotExist('*PREFIX*talk_guests', [
Copy link
Member

Choose a reason for hiding this comment

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

IMHO inserting an initial name should also dispatch an event.

Copy link
Member Author

Choose a reason for hiding this comment

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

It does, because of the $dispatchEvent = true;

Signed-off-by: Joas Schilling <coding@schilljs.com>

try {
$oldName = $this->getNameBySessionHash($sessionHash);
$dispatchEvent = $oldName !== $displayName;
Copy link
Member

Choose a reason for hiding this comment

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

Better, though I would rather write it like this to save the redundant comparison:

if ($oldName !== $displayName) {
   ...
} else {
    $dispatchEvent = false;
}

But that's just my personal taste 😉

Signed-off-by: Joas Schilling <coding@schilljs.com>
@Ivansss Ivansss merged commit c322163 into master May 9, 2018
@Ivansss Ivansss deleted the bugfix/865/stop-refreshing-participant-list-when-a-guest-is-chatting branch May 9, 2018 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review bug feature: chat 💬 Chat and system messages feature: signaling 📶 Internal and external signaling backends
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants