Fix hanging /connect notification issue (#1174)

* Adjust channel opened check to mitigate race conditions maybe

* Add fix to jump user straight to apporpriate unopened channel
This commit is contained in:
Ben Halpern 2018-11-21 12:08:09 -05:00 committed by GitHub
parent 915e2d77b6
commit b34ee48c1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -113,6 +113,7 @@ export default function getUnopenedChannels(user, successCb) {
if (json.length > 0) {
number.classList.add("showing")
number.innerHTML = json.length
document.getElementById("connect-link").href = `/connect/${json[0].adjusted_slug}` // Jump the user directly to the channel where appropriate
} else {
number.classList.remove("showing")
}

View file

@ -57,7 +57,7 @@ class Message < ApplicationRecord
def update_all_has_unopened_messages_statuses
chat_channel.
chat_channel_memberships.
where("last_opened_at < ?", 4.seconds.ago).
where("last_opened_at < ?", 10.seconds.ago).
where.
not(user_id: user_id).
update_all(has_unopened_messages: true)