mirror of
https://github.com/discourse/discourse.git
synced 2024-12-24 19:24:00 +08:00
c6c633e041
This commit fixes two issues at play. The first was introduced
in f6c852b
(or maybe not introduced
but rather revealed). When a user posted a new message in a topic,
they received the unread topic tracking state MessageBus message,
and the Unread (X) indicator was incremented by one, because with the
aforementioned perf commit we "guess" the correct last read post
for the user, because we no longer calculate individual users' read
status there. This meant that every time a user posted in a topic
they tracked, the unread indicator was incremented. To get around
this, we can just exclude the user who created the post from the
target users of the unread state message.
The second issue was related to the private message topic tracking
state, and was somewhat similar. Whenever a user created a new private
message, the New (X) indicator was incremented, and could not be
cleared until the page was refreshed. To solve this, we just don't
update the topic state for the user when the new_topic tracking state
message comes through if the user who created the topic is the
same as the current user.
cf. https://meta.discourse.org/t/bottom-of-topic-shows-there-is-1-unread-remaining-when-there-are-actually-0-unread-topics-remaining/220817
23 lines
581 B
Ruby
23 lines
581 B
Ruby
# frozen_string_literal: true
|
|
|
|
Fabricator(:topic_user) do
|
|
user
|
|
topic
|
|
end
|
|
|
|
Fabricator(:topic_user_tracking, from: :topic_user) do
|
|
notification_level { NotificationLevels.topic_levels[:tracking] }
|
|
end
|
|
|
|
Fabricator(:topic_user_watching, from: :topic_user) do
|
|
notification_level { NotificationLevels.topic_levels[:watching] }
|
|
end
|
|
|
|
Fabricator(:topic_user_regular, from: :topic_user) do
|
|
notification_level { NotificationLevels.topic_levels[:regular] }
|
|
end
|
|
|
|
Fabricator(:topic_user_muted, from: :topic_user) do
|
|
notification_level { NotificationLevels.topic_levels[:muted] }
|
|
end
|