Fix notification for new conversations

This commit is contained in:
Steffen van Bergerem 2015-02-19 06:51:39 +01:00
parent a19b91083e
commit 53714c4699
3 changed files with 9 additions and 3 deletions

View file

@ -20,7 +20,7 @@ class Conversation < ActiveRecord::Base
def max_participants
errors.add(:max_participants, "too many participants") if participants.count > 20
end
def local_recipients
recipients.each do |recipient|
if recipient.local?
@ -86,7 +86,7 @@ class Conversation < ActiveRecord::Base
end
def receive(user, person)
cnv = Conversation.find_or_create_by!(self.attributes)
cnv = Conversation.create_with(self.attributes).find_or_create_by!(guid: guid)
self.participants.each do |participant|
ConversationVisibility.find_or_create_by(conversation_id: cnv.id, person_id: participant.id)

View file

@ -20,5 +20,7 @@ Feature: private conversations
And "Alice Awesome" should be part of active conversation
And I should see "hello, alice!" within ".stream_container"
When I sign in as "alice@alice.alice"
And I reply with "hey, how you doing?"
Then I should have 1 unread private message
And I should have 1 email delivery
When I reply with "hey, how you doing?"
Then I should see "hey, how you doing?" within ".stream_container"

View file

@ -4,6 +4,10 @@ Then /^"([^"]*)" should be part of active conversation$/ do |name|
end
end
Then /^I should have (\d+) unread private messages?$/ do |n_unread|
find("header #conversations_badge .badge_count").should have_content(n_unread)
end
Then /^I send a message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)"$/ do |subject, text, person|
step %(I am on the conversations page)
within("#conversation_new", match: :first) do