Fix notification for new conversations
This commit is contained in:
parent
a19b91083e
commit
53714c4699
3 changed files with 9 additions and 3 deletions
|
|
@ -20,7 +20,7 @@ class Conversation < ActiveRecord::Base
|
||||||
def max_participants
|
def max_participants
|
||||||
errors.add(:max_participants, "too many participants") if participants.count > 20
|
errors.add(:max_participants, "too many participants") if participants.count > 20
|
||||||
end
|
end
|
||||||
|
|
||||||
def local_recipients
|
def local_recipients
|
||||||
recipients.each do |recipient|
|
recipients.each do |recipient|
|
||||||
if recipient.local?
|
if recipient.local?
|
||||||
|
|
@ -86,7 +86,7 @@ class Conversation < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive(user, person)
|
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|
|
self.participants.each do |participant|
|
||||||
ConversationVisibility.find_or_create_by(conversation_id: cnv.id, person_id: participant.id)
|
ConversationVisibility.find_or_create_by(conversation_id: cnv.id, person_id: participant.id)
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,7 @@ Feature: private conversations
|
||||||
And "Alice Awesome" should be part of active conversation
|
And "Alice Awesome" should be part of active conversation
|
||||||
And I should see "hello, alice!" within ".stream_container"
|
And I should see "hello, alice!" within ".stream_container"
|
||||||
When I sign in as "alice@alice.alice"
|
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"
|
Then I should see "hey, how you doing?" within ".stream_container"
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@ Then /^"([^"]*)" should be part of active conversation$/ do |name|
|
||||||
end
|
end
|
||||||
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|
|
Then /^I send a message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)"$/ do |subject, text, person|
|
||||||
step %(I am on the conversations page)
|
step %(I am on the conversations page)
|
||||||
within("#conversation_new", match: :first) do
|
within("#conversation_new", match: :first) do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue