[telegram-desktop/f31] Backported upstream patches with different fixes.