Skip to content

Commit

Permalink
fix: Quick Toggle Anonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Feb 10, 2024
1 parent 8136a47 commit 97e2661
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 97e2661

Please sign in to comment.