Commit c4376361 authored by Jason Robinson's avatar Jason Robinson

Fix message_spec test and add tests for private message notification unread count. Update changelog

parent 6cf6f1dd
......@@ -41,6 +41,7 @@
* Fix misconfiguration of Devise to allow the session to be remembered. [#3472](https://github.com/diaspora/diaspora/issues/3472)
* Fix problem with show reshares_count in stream. [#3700](https://github.com/diaspora/diaspora/pull/3700)
* Fix error with notifications count in mobile. [#3721](https://github.com/diaspora/diaspora/pull/3721)
* Fix conversation unread message count bug. [#2321](https://github.com/diaspora/diaspora/issues/2321)
## Gem updates
......
......@@ -96,12 +96,12 @@ describe Message do
let(:build_object) { Message.new(:author => @alice.person, :text => "ohai!", :conversation => @conversation) }
it_should_behave_like 'it is relayable'
describe '#after_receive' do
describe '#increase_unread' do
it 'increments the conversation visiblity for the conversation' do
ConversationVisibility.where(:conversation_id => @object_by_recipient.reload.conversation.id,
:person_id => @local_luke.person.id).first.unread.should == 0
@object_by_recipient.receive(@local_luke, @local_leia.person)
@object_by_recipient.increase_unread(@local_luke)
ConversationVisibility.where(:conversation_id => @object_by_recipient.reload.conversation.id,
:person_id => @local_luke.person.id).first.unread.should == 1
end
......
......@@ -40,6 +40,31 @@ describe Notifications::PrivateMessage do
@user2.should_receive(:mail)
n.email_the_user(@msg, @user1.person)
end
it 'increases user unread count - author user 1' do
message = @cnv.messages.build(
:text => "foo bar",
:author => @user1.person
)
message.save
n = Notifications::PrivateMessage.make_notification(@user2, message, @user1.person, Notifications::PrivateMessage)
ConversationVisibility.where(:conversation_id => message.reload.conversation.id,
:person_id => @user2.person.id).first.unread.should == 1
end
it 'increases user unread count - author user 2' do
message = @cnv.messages.build(
:text => "foo bar",
:author => @user2.person
)
message.save
n = Notifications::PrivateMessage.make_notification(@user1, message, @user2.person, Notifications::PrivateMessage)
ConversationVisibility.where(:conversation_id => message.reload.conversation.id,
:person_id => @user1.person.id).first.unread.should == 1
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment