-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add conversation status selector #1647
Conversation
ae3dcb0
to
2d031b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely work!
app/routes/project/conversations.js
Outdated
let controller = this.controllerFor('project.conversations'); | ||
controller.set('currentlyLoading', true); | ||
let that = this; | ||
transition.promise.finally(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can a hash rocket be used here?
|
||
set(this, 'status', 'open'); | ||
|
||
renderPage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does renderPage
need an away? I'm guessing not since this passes, but have seen await
with render in the new qunit api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might need it of we're setting a component property without wrapping it in a run
. Someone ought to try that out.
@@ -214,11 +212,28 @@ test('Project admin can reopen a conversation', function(assert) { | |||
project: project.slug | |||
}); | |||
|
|||
andThen(() => { | |||
page.statusSelect.openButton.click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new async await would be rid of the andThens'. I'm sure you already know that but I found it was useful to start moving acceptance tests over 1 test file at a time (maybe a codemod) available now???
queryParams: ['status'], | ||
status: 'open', | ||
|
||
currentlyLoading: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want the default to be false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, since it could result in some weird state.
app/routes/project/conversations.js
Outdated
transition.promise.finally(function() { | ||
controller.set('currentlyLoading', false); | ||
that.transitionTo('project.conversations.index'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using an arrow function should eliminate the need for that
if (get(conversations, 'length') > 0) { | ||
this.transitionTo('project.conversations.conversation', get(conversations, 'firstObject')); | ||
let sortedConversations | ||
= conversations.filterBy('status', status).sortBy('updatedAt'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to filter here, right? The model should already be filtered. If it's not, then we should add a comment as to why that is.
You do need to sort, but not until you know the array isn't empty. That shouldn't matter much, though. Sorting a blank array is not expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filtering does need to happen since the model does not necessarily update when an individual conversation changes.
|
||
set(this, 'status', 'open'); | ||
|
||
renderPage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might need it of we're setting a component property without wrapping it in a run
. Someone ought to try that out.
f4e08f1
to
8bdce3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Did not realize about the filtering.
8bdce3c
to
2c3455f
Compare
andThen(() => { | ||
page.conversations(1).click(); | ||
}); | ||
page.conversations(1).click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await
here as well? I thik it may b/c click
is an async test helper.
andThen(() => { | ||
page.conversations(0).click(); | ||
}); | ||
page.conversations(0).click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
What's in this PR?
Add a selector to change the conversation status.
Needs tests.
References
Progress on: #1632