Correct change guild not working on music page

This commit is contained in:
Sebastien 2019-06-15 14:20:19 +02:00
parent a4f25a49c6
commit ebb1316469
2 changed files with 5 additions and 10 deletions

View File

@ -197,7 +197,7 @@ public class GeneralWebView {
private Model addGuildAndRedirect(Model model, String token, String guildId, List<Guild> mutualGuilds){
public static Model addGuildAndRedirect(Model model, String token, String guildId, List<Guild> mutualGuilds){
Guild guild = MainBot.jda.getGuildById(guildId);
if(guild != null){
model.addAttribute("guild_name", guild.getName());

View File

@ -26,11 +26,11 @@ import javax.servlet.http.HttpServletResponse;
@Controller
public class MusicWebView {
UserRepository userRepository;
private UserRepository userRepository;
UserUtils userUtils = UserUtils.getInstance();
private UserUtils userUtils = UserUtils.getInstance();
Logger logger = LogManager.getLogger();
private Logger logger = LogManager.getLogger();
@Autowired
@ -51,12 +51,7 @@ public class MusicWebView {
User user = MainBot.jda.getUserById(userE.getJdaId());
if(user == null)
return "redirect:/";
Guild guild = MainBot.jda.getGuildById(guildId);
if(guild != null)
model.addAttribute("guild_name", guild.getName());
else
model.addAttribute("guild_name", "");
model.addAttribute("isAdmin", SettingsUtils.getInstance().checkPermission(token, guildId));
GeneralWebView.addGuildAndRedirect(model, token, guildId, user.getMutualGuilds());
return CheckPage.getPageIfReady("music");
} catch (UnknownTokenException e) {