mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FEATURE: Publish read topic tracking events for private messages. (#14274)
Follow-up to fc1fd1b41689694b3916dc4e10605eb9b8bb89b7
This commit is contained in:

committed by
GitHub

parent
1e05175364
commit
412587f70a
@ -226,7 +226,14 @@ describe TopicUser do
|
||||
freeze_time tomorrow
|
||||
|
||||
Fabricate(:post, topic: topic, user: user)
|
||||
TopicUser.update_last_read(user, topic.id, 2, 1, 0)
|
||||
channel = TopicTrackingState.unread_channel_key(user.id)
|
||||
|
||||
messages = MessageBus.track_publish(channel) do
|
||||
TopicUser.update_last_read(user, topic.id, 2, 1, 0)
|
||||
end
|
||||
|
||||
expect(messages.blank?).to eq(false)
|
||||
|
||||
topic_user = TopicUser.get(topic, user)
|
||||
|
||||
expect(topic_user.last_read_post_number).to eq(2)
|
||||
@ -270,6 +277,20 @@ describe TopicUser do
|
||||
.to eq(TopicUser.notification_levels[:regular])
|
||||
end
|
||||
|
||||
it 'should publish the right message_bus message' do
|
||||
TopicUser.update_last_read(user, topic.id, 1, 1, 0)
|
||||
|
||||
Fabricate(:post, topic: topic, user: user)
|
||||
|
||||
channel = PrivateMessageTopicTrackingState.user_channel(user.id)
|
||||
|
||||
messages = MessageBus.track_publish(channel) do
|
||||
TopicUser.update_last_read(user, topic.id, 2, 1, 0)
|
||||
end
|
||||
|
||||
expect(messages.blank?).to eq(false)
|
||||
end
|
||||
|
||||
describe 'inviting a group' do
|
||||
let(:group) do
|
||||
Fabricate(:group,
|
||||
|
Reference in New Issue
Block a user