diff --git a/src/main/java/pm/axe/ui/pages/user/profile/tabs/ProfileTab.java b/src/main/java/pm/axe/ui/pages/user/profile/tabs/ProfileTab.java index f9110dc8b..d5cdfc108 100644 --- a/src/main/java/pm/axe/ui/pages/user/profile/tabs/ProfileTab.java +++ b/src/main/java/pm/axe/ui/pages/user/profile/tabs/ProfileTab.java @@ -85,11 +85,14 @@ public void tabInit(final User user) { //telegram section FlexLayout telegramLayout = new FlexLayout(); + telegramLayout.setAlignItems(Alignment.BASELINE); + Optional telegramAccount = getTelegramAccount(); - if (telegramAccount.isPresent()) { + Optional telegramUsername = getTelegramUsername(); + if (telegramAccount.isPresent() && telegramUsername.isPresent()) { //FIXME fix logic TextField telegramField = new TextField("Telegram"); telegramField.setPrefixComponent(VaadinIcon.AT.create()); - telegramField.setValue(telegramAccount.get().getAccountName()); + telegramField.setValue(telegramUsername.get()); Button unlink = new Button("Unlink"); telegramLayout.add(telegramField, unlink); } else { @@ -139,4 +142,13 @@ private Optional getTelegramToken() { } return Optional.ofNullable(tgToken); } + + private Optional getTelegramUsername() { + Optional telegramAccount = getTelegramAccount(); + if (telegramAccount.isPresent()) { + return accountService.decryptAccountName(telegramAccount.get()); + } else { + return Optional.empty(); + } + } }