mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
UX: Invited users should watch PM topic once topic has been visited.
https://meta.discourse.org/t/notifications-not-received-for-private-messages-im-invited-to/71577/11
This commit is contained in:
@ -234,13 +234,38 @@ describe TopicUser do
|
||||
end
|
||||
|
||||
context 'private messages' do
|
||||
let(:target_user) { Fabricate(:user) }
|
||||
|
||||
let(:post) do
|
||||
create_post(
|
||||
archetype: Archetype.private_message,
|
||||
target_usernames: target_user.username
|
||||
);
|
||||
end
|
||||
|
||||
let(:topic) { post.topic }
|
||||
|
||||
it 'should ensure recepients and senders are watching' do
|
||||
expect(TopicUser.get(topic, post.user).notification_level)
|
||||
.to eq(TopicUser.notification_levels[:watching])
|
||||
|
||||
target_user = Fabricate(:user)
|
||||
post = create_post(archetype: Archetype.private_message, target_usernames: target_user.username);
|
||||
expect(TopicUser.get(topic, target_user).notification_level)
|
||||
.to eq(TopicUser.notification_levels[:watching])
|
||||
end
|
||||
|
||||
expect(TopicUser.get(post.topic, post.user).notification_level).to eq(TopicUser.notification_levels[:watching])
|
||||
expect(TopicUser.get(post.topic, target_user).notification_level).to eq(TopicUser.notification_levels[:watching])
|
||||
it 'should ensure invited user is watching once visited' do
|
||||
another_user = Fabricate(:user)
|
||||
topic.invite(target_user, another_user.username)
|
||||
TopicUser.track_visit!(topic.id, another_user.id)
|
||||
|
||||
expect(TopicUser.get(topic, another_user).notification_level)
|
||||
.to eq(TopicUser.notification_levels[:watching])
|
||||
|
||||
another_user = Fabricate(:user)
|
||||
TopicUser.track_visit!(topic.id, another_user.id)
|
||||
|
||||
expect(TopicUser.get(topic, another_user).notification_level)
|
||||
.to eq(TopicUser.notification_levels[:regular])
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user