This diff unifies the logic for checking whether a client can toggle a pin. Previously, there was a hacky check in two places (threadInfo.sourceMessageID === messageInfo.id), as well as duplicated checking logic across web and native.
This diff achieves a few things to clean this code up:
- For native, it moves the call to check whether the client can toggle pins up to message.react.js so it can be passed in as a prop to both TextMessage and MultimediaMessage. This is better than duplicating the call in the individual components.
- Updated isInvalidPinSource to take in an optional parameter threadInfo, and if defined we can do the aforementioned check here in one place.
- In my opinion, this is better than doing this in all of the individual message specs since that’s going to result in a ton of copy and pasted hacky checks.
- This optional parameter will not be provided from callsites to isInvalidPinSource from the server
- Creates a helper function canToggleMessagePin that is used for the client tooltips. This will check both isInvalidSidebarSource and also whether the client thread has permission to manage pins.
Resolves ENG-5619
Depends on D9634