add canAdminister permissions to conversation-thread
What's in this PR?
Add the ability for authorized users (admin) to filter by conversation part type.
References #1692
Progress on: #1597
Any test that needs to render a conversation is currently failing. At day's end, my thinking is this is happening because I haven't figured out how to write users who are admins into the test because, before this, the tests didn't need users to work. Now that we're working with user permissions, it does.
If you poke around, I haven't defined a user like let user =..., I've mocked a fake "project" and made a user object that includes an admin role.
let project = {
projectUsers: [
{ role: 'admin' }
]
};
My thought tomorrow was to start by mocking a user, then calling that user inside of project, but now that I write this, it sounds dumb to do that.
After reading https://www.npmjs.com/package/ember-can, and then looking again at app/abilities/project.js, I might start tomorrow by putting user=user to the hbs. I don't think I'm giving ability:project what it needs here.
After a long day of me mostly failing/reading guides, tests are still in the same state as yesterday, aka "Any test that needs to render a conversation is currently failing."
With Nikola's help, I've/Nikola has written a filter that returns only comment parts to users who don't have the canAdminister property.
I'm still struggling with placing the new filter in the hbs, I'm just not used to working in it and it feels like I'm just looking at a wall of code. I've been reading guides and going through the codebase to see other examples, but I'm still struggling at the connections. Starting tomorrow, my biggest blocker is simply just placement in the hbs, after that, I have confidence I can knock out the tests pretty easy.
@daveconnis I looked into why your tests are failing. The reason is, the conversation models being created by mirage for the purpose of those tests are created without an associated project.
Look into the mirage factories we have, as well as into how the records in those tests specifically are being created to figure out what the actual problem is.
Remember, if we have a specific project, then any created message needs to belong to that project, and any created conversation needs to belong to that message and that project.
Then, the system figures out if a created user can administer the created project by checking if a projectUser record with a role of "admin" or "owner" exists for that project and that user.