mirror of https://github.com/NekoX-Dev/NekoX.git
Allow group edit
This commit is contained in:
parent
356fadca06
commit
e1205b57c8
|
@ -674,7 +674,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
presentFragment(fragment);
|
||||
});
|
||||
|
||||
if (ChatObject.isChannel(currentChat)) {
|
||||
if (ChatObject.isChannel(currentChat) && ChatObject.hasAdminRights(currentChat)) {
|
||||
logCell = new TextCell(context);
|
||||
logCell.setTextAndIcon(LocaleController.getString("EventLog", R.string.EventLog), R.drawable.group_log, false);
|
||||
logCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
||||
|
@ -696,7 +696,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
infoSectionCell = new ShadowSectionCell(context);
|
||||
linearLayout1.addView(infoSectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
|
||||
if (!ChatObject.hasAdminRights(currentChat)) {
|
||||
if (false && !ChatObject.hasAdminRights(currentChat)) {
|
||||
infoContainer.setVisibility(View.GONE);
|
||||
settingsTopSectionCell.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -869,6 +869,22 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
return count;
|
||||
}
|
||||
|
||||
private int getChannelAdminCount() {
|
||||
if (info == null) {
|
||||
return 1;
|
||||
}
|
||||
int count = 0;
|
||||
for (int a = 0, N = info.participants.participants.size(); a < N; a++) {
|
||||
TLRPC.ChatParticipant chatParticipant = info.participants.participants.get(a);
|
||||
TLRPC.ChannelParticipant channelParticipant = ((TLRPC.TL_chatChannelParticipant) chatParticipant).channelParticipant;
|
||||
if (channelParticipant instanceof TLRPC.TL_channelParticipantAdmin ||
|
||||
channelParticipant instanceof TLRPC.TL_channelParticipantCreator) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private void processDone() {
|
||||
if (donePressed || nameTextView == null) {
|
||||
return;
|
||||
|
@ -1173,7 +1189,7 @@ 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) ? info.admins_count : getAdminCount()), R.drawable.actions_addadmin, true);
|
||||
adminCell.setTextAndValueAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", ChatObject.isChannel(currentChat) ? getChannelAdminCount() : getAdminCount()), R.drawable.actions_addadmin, true);
|
||||
} else {
|
||||
if (isChannel) {
|
||||
membersCell.setTextAndIcon(LocaleController.getString("ChannelSubscribers", R.string.ChannelSubscribers), R.drawable.actions_viewmembers, true);
|
||||
|
|
|
@ -418,7 +418,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
|
|||
slowmodeSelectRow = rowCount++;
|
||||
slowmodeInfoRow = rowCount++;
|
||||
}
|
||||
if (ChatObject.isChannel(currentChat)) {
|
||||
if (ChatObject.isChannel(currentChat) && ChatObject.hasAdminRights(currentChat)) {
|
||||
if (participantsDivider2Row == -1) {
|
||||
participantsDivider2Row = rowCount++;
|
||||
}
|
||||
|
@ -459,7 +459,8 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
|
|||
blockedEmptyRow = rowCount++;
|
||||
}
|
||||
} else if (type == TYPE_ADMIN) {
|
||||
if (ChatObject.isChannel(currentChat) && currentChat.megagroup && (info == null || info.participants_count <= 200)) {
|
||||
if (ChatObject.isChannel(currentChat) && currentChat.megagroup && (info == null || info.participants_count <= 200)
|
||||
&& ChatObject.hasAdminRights(currentChat)) {
|
||||
recentActionsRow = rowCount++;
|
||||
addNewSectionRow = rowCount++;
|
||||
}
|
||||
|
|
|
@ -3067,7 +3067,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
if (chat_id > 0) {
|
||||
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id);
|
||||
if (ChatObject.isChannel(chat)) {
|
||||
if (ChatObject.hasAdminRights(chat) || chat.megagroup && ChatObject.canChangeChatInfo(chat)) {
|
||||
if (ChatObject.hasAdminRights(chat) || chat.megagroup) {
|
||||
editItem = menu.addItem(edit_channel, R.drawable.group_edit_profile);
|
||||
}
|
||||
if (!chat.megagroup && chatInfo != null && chatInfo.can_view_stats) {
|
||||
|
|
Loading…
Reference in New Issue