Check if the message is a group or super group message for GROUP_ADMIN, #390
This commit is contained in:
parent
b9da279fdf
commit
677b401fc6
@ -637,7 +637,7 @@ public abstract class AbilityBot extends TelegramLongPollingBot {
|
||||
Privacy privacy;
|
||||
int id = user.id();
|
||||
|
||||
privacy = isCreator(id) ? CREATOR : isAdmin(id) ? ADMIN : isGroupAdmin(update, id)? GROUP_ADMIN : PUBLIC;
|
||||
privacy = isCreator(id) ? CREATOR : isAdmin(id) ? ADMIN : (isGroupUpdate(update) || isSuperGroupUpdate(update)) && isGroupAdmin(update, id)? GROUP_ADMIN : PUBLIC;
|
||||
|
||||
boolean isOk = privacy.compareTo(trio.b().privacy()) >= 0;
|
||||
|
||||
|
@ -362,7 +362,7 @@ public class AbilityBotTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canValidateGroupAdminPrivacy() throws TelegramApiException {
|
||||
public void canValidateGroupAdminPrivacy() {
|
||||
Update update = mock(Update.class);
|
||||
Message message = mock(Message.class);
|
||||
org.telegram.telegrambots.api.objects.User user = mock(User.class);
|
||||
@ -383,7 +383,7 @@ public class AbilityBotTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canRestrictNormalUsersFromGroupAdminAbilities() throws TelegramApiException {
|
||||
public void canRestrictNormalUsersFromGroupAdminAbilities() {
|
||||
Update update = mock(Update.class);
|
||||
Message message = mock(Message.class);
|
||||
org.telegram.telegrambots.api.objects.User user = mock(User.class);
|
||||
|
Loading…
Reference in New Issue
Block a user