mirror of https://github.com/NekoX-Dev/NekoX.git
fix group admin count
This commit is contained in:
parent
2f85d94a34
commit
fe48abb061
|
@ -133,6 +133,8 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
|
||||
private final static int done_button = 1;
|
||||
|
||||
private int realAdminCount = 0;
|
||||
|
||||
public ChatEditActivity(Bundle args) {
|
||||
super(args);
|
||||
avatarDrawable = new AvatarDrawable();
|
||||
|
@ -885,6 +887,18 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
return count;
|
||||
}
|
||||
|
||||
private void getRealChannelAdminCount() {
|
||||
TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants();
|
||||
req.channel = getMessagesController().getInputChannel(chatId);
|
||||
req.filter = new TLRPC.TL_channelParticipantsAdmins();
|
||||
int reqId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
||||
TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
|
||||
realAdminCount = res.count;
|
||||
adminCell.setTextAndValueAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", res.count), R.drawable.actions_addadmin, true);
|
||||
}));
|
||||
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
|
||||
}
|
||||
|
||||
private void processDone() {
|
||||
if (donePressed || nameTextView == null) {
|
||||
return;
|
||||
|
@ -1189,7 +1203,14 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
}
|
||||
blockCell.setTextAndValueAndIcon(LocaleController.getString("ChannelPermissions", R.string.ChannelPermissions), String.format("%d/%d", count, 8), R.drawable.actions_permissions, true);
|
||||
}
|
||||
adminCell.setTextAndValueAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", ChatObject.isChannel(currentChat) ? ChatObject.hasAdminRights(currentChat) ? info.admins_count : getChannelAdminCount() : getAdminCount()), R.drawable.actions_addadmin, true);
|
||||
if (ChatObject.isChannel(currentChat) && !ChatObject.hasAdminRights(currentChat) && info.participants.participants.size() != info.participants_count && realAdminCount == 0) {
|
||||
adminCell.setTextAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), R.drawable.actions_addadmin, true);
|
||||
} else {
|
||||
adminCell.setTextAndValueAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", ChatObject.isChannel(currentChat) ? ChatObject.hasAdminRights(currentChat) ? info.admins_count : realAdminCount == 0 ? getChannelAdminCount() : realAdminCount : getAdminCount()), R.drawable.actions_addadmin, true);
|
||||
}
|
||||
if (ChatObject.isChannel(currentChat) && !ChatObject.hasAdminRights(currentChat) && info.participants.participants.size() != info.participants_count) {
|
||||
getRealChannelAdminCount();
|
||||
}
|
||||
} else {
|
||||
if (isChannel) {
|
||||
membersCell.setTextAndIcon(LocaleController.getString("ChannelSubscribers", R.string.ChannelSubscribers), R.drawable.actions_viewmembers, true);
|
||||
|
|
Loading…
Reference in New Issue