[keyserver] Call canToggleMessagePin in toggleMessagePinForThread
Summary:
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
Test Plan: Made sure that pinning / unpinning messages still worked on the server.
Reviewers: ashoat, atul, ginsu
Reviewed By: ashoat
Subscribers: tomek, wyilio, ashoat
Differential Revision: https://phab.comm.dev/D9652