This is some feedback from D9638:
Still, it might be a good idea to add this to toggleMessagePinForThread. Besides the benefits of consistently checking the same condition in as many places as possible, you also get a bonus for moving the fetchServerThreadInfos call earlier. I think that lets you replace the isInvalidPinSource check there with canToggleMessagePin, and drop the checkThreadPermission entirely. (You'd need to update the types on canToggleMessagePin I think.)
While the fact that we won't benefit from the additional check is true (I confirmed this as well), we do get to benefit from a few of the things that @ashoat mentioned.
Resolves https://linear.app/comm/issue/ENG-5628/call-cantogglemessagepin-in-togglemessagepinforthread
Depends on D9638