Check if the message is a group or super group message for GROUP_ADMIN, #390

This commit is contained in:
Abbas Abou Daya 2018-05-08 03:39:21 +03:00
parent b9da279fdf
commit 677b401fc6
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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);