Skip to content

Commit 9623ef4

Browse files
committed
add project to conversation
1 parent fae8f7c commit 9623ef4

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

app/components/conversations/new-conversation-modal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default Component.extend({
3636
project
3737
});
3838

39-
let conversation = store.createRecord('conversation', { user });
39+
let conversation = store.createRecord('conversation', { user, project });
4040

4141
get(message, 'conversations').pushObject(conversation);
4242

app/models/conversation.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export default Model.extend({
1010

1111
conversationParts: hasMany('conversation-part', { async: true }),
1212
message: belongsTo('message', { async: true }),
13-
user: belongsTo('user', { async: true })
13+
project: belongsTo('project', { async: true }),
14+
user: belongsTo('user', { async: true }),
1415
});

tests/integration/components/conversations/new-conversation-modal-test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ moduleForComponent('conversations/new-conversation-modal', 'Integration | Compon
3434
});
3535

3636
test('it initiates a conversation and opens the modal when open button is clicked', function(assert) {
37-
assert.expect(6);
37+
assert.expect(7);
3838

3939
let store = get(this, 'store');
4040

@@ -55,6 +55,7 @@ test('it initiates a conversation and opens the modal when open button is clicke
5555

5656
assert.equal(get(message, 'project.id'), 'foo');
5757
assert.equal(get(message, 'conversations.firstObject.user.id'), 'bar');
58+
assert.equal(get(message, 'conversations.firstObject.project.id'), 'foo');
5859
assert.equal(get(message, 'author.id'), 'baz');
5960
assert.equal(get(message, 'initiatedBy'), 'admin');
6061
});

tests/unit/models/conversation-test.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ test('it exists', function(assert) {
1717

1818
testForAttributes('conversation', ['insertedAt', 'readAt', 'status', 'updatedAt']);
1919
testForBelongsTo('conversation', 'message');
20+
testForBelongsTo('conversation', 'project');
2021
testForBelongsTo('conversation', 'user');

0 commit comments

Comments
 (0)