[lib] Set roles and permissions in thick threads based on parent permissions
Summary:
When we create a thick thread, we should check if the viewer is a member and set the role and permissions accordingly. This case can happen when we receive a create sidebar operation.
When a user leaves a sidebar, we should also update their permissions.
https://linear.app/comm/issue/ENG-9318/sidebar-joining-issues
Test Plan:
Create a thick sidebar without the viewer and check if the join button is visible. Join and leave the sidebar - the button should reappear.
Created a new sidebar in a thread with three users and added one of them. Checked if the added user can send messages and if the second user can join the sidebar.
Reviewers: kamil, ashoat
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D13418