Skip to content

Commit

Permalink
add project to conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Dec 27, 2017
1 parent fae8f7c commit 00f09d9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/components/conversations/new-conversation-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default Component.extend({
project
});

let conversation = store.createRecord('conversation', { user });
let conversation = store.createRecord('conversation', { user, project });

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

Expand Down
1 change: 1 addition & 0 deletions app/models/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default Model.extend({

conversationParts: hasMany('conversation-part', { async: true }),
message: belongsTo('message', { async: true }),
project: belongsTo('project', { async: true }),
user: belongsTo('user', { async: true })
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ moduleForComponent('conversations/new-conversation-modal', 'Integration | Compon
});

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

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

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

assert.equal(get(message, 'project.id'), 'foo');
assert.equal(get(message, 'conversations.firstObject.user.id'), 'bar');
assert.equal(get(message, 'conversations.firstObject.project.id'), 'foo');
assert.equal(get(message, 'author.id'), 'baz');
assert.equal(get(message, 'initiatedBy'), 'admin');
});
Expand Down
1 change: 1 addition & 0 deletions tests/unit/models/conversation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ test('it exists', function(assert) {

testForAttributes('conversation', ['insertedAt', 'readAt', 'status', 'updatedAt']);
testForBelongsTo('conversation', 'message');
testForBelongsTo('conversation', 'project');
testForBelongsTo('conversation', 'user');

0 comments on commit 00f09d9

Please sign in to comment.