diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index 50305ff8b4..5c89449b1a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -3704,6 +3704,24 @@ private void createSenderSelectView() { senderSelectPopupWindow = new SenderSelectPopup(getContext(), parentFragment, controller, chatFull, delegate.getSendAsPeers(), (recyclerView, senderView, peer) -> { if (senderSelectPopupWindow == null) return; if (chatFull != null) { + + var chat = controller.getChat(chatFull.id); + if (chat != null && chat.creator) { + var self = UserConfig.getInstance(currentAccount).getCurrentUser(); + + if (peer.channel_id == chat.id) { + var rights = chat.admin_rights; + rights.anonymous = true; + var rank = MessagesController.getInstance(currentAccount).getAdminRank(chat.id, self.id); + MessagesController.getInstance(currentAccount).setUserAdminRole(chat.id, self, rights, rank, false, parentFragment, false, false, null, null); + } else if (peer.user_id == self.id) { + var rights = chat.admin_rights; + rights.anonymous = false; + var rank = MessagesController.getInstance(currentAccount).getAdminRank(chat.id, self.id); + MessagesController.getInstance(currentAccount).setUserAdminRole(chat.id, self, rights, rank, false, parentFragment, false, false, null, null); + } + } + chatFull.default_send_as = peer; updateSendAsButton(); }