Improvements to user drafts (#6226)

* drafts in user profile: only show to user herself (not to admins), use avatar replying to (instead of topic OP), add keyboard shortcut for drafts, simplify display labels

* use JSON when testing Draft.stream
This commit is contained in:
Penar Musaraj
2018-08-01 17:41:27 -04:00
committed by Sam
parent 8147130412
commit 4a872823e7
12 changed files with 34 additions and 54 deletions

View File

@ -73,19 +73,19 @@ describe Draft do
end
it "should include the correct number of drafts in the stream" do
Draft.set(@user, "test", 0, "first")
Draft.set(@user, "test2", 0, "second")
Draft.set(@user, "test", 0, '{"reply":"hey.","action":"createTopic","title":"Hey"}')
Draft.set(@user, "test2", 0, '{"reply":"howdy"}')
expect(stream.count).to eq(2)
end
it "should include the right topic id in a draft reply in the stream" do
Draft.set(@user, "topic_#{public_topic.id}", 0, "hey")
Draft.set(@user, "topic_#{public_topic.id}", 0, '{"reply":"hi"}')
draft_row = stream.first
expect(draft_row.topic_id).to eq(public_topic.id)
end
it "should include the right draft username in the stream" do
Draft.set(@user, "topic_#{public_topic.id}", 0, "hey")
Draft.set(@user, "topic_#{public_topic.id}", 0, '{"reply":"hey"}')
draft_row = stream.first
expect(draft_row.draft_username).to eq(@user.username)
end