This diff handles a case when a pinned message becomes deleted.
There are a couple of possible solutions, from which the simplest one would be to hide pins on the client - a one line change. The problem is that there's one place that doesn't respect the client logic - a banner with pin count. The count is a value stored on a keyserver in a thread table. So in order for everything to work correctly, we need a more complicated (and also more proper) solution where messages indeed get unpinned.
In this solution we simply call an already existing logic - toggling a pin. There are two modifications that we need: we don't want a message to be generated, and we shouldn't check permissions - because of that we're introducing a new behavior to the existing logic.
https://linear.app/comm/issue/ENG-10495/handle-unpinning-a-deleted-message
Depends on D14548