Correct change guild not working on music page
This commit is contained in:
parent
a4f25a49c6
commit
ebb1316469
@ -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);
|
Guild guild = MainBot.jda.getGuildById(guildId);
|
||||||
if(guild != null){
|
if(guild != null){
|
||||||
model.addAttribute("guild_name", guild.getName());
|
model.addAttribute("guild_name", guild.getName());
|
||||||
|
@ -26,11 +26,11 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
@Controller
|
@Controller
|
||||||
public class MusicWebView {
|
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
|
@Autowired
|
||||||
@ -51,12 +51,7 @@ public class MusicWebView {
|
|||||||
User user = MainBot.jda.getUserById(userE.getJdaId());
|
User user = MainBot.jda.getUserById(userE.getJdaId());
|
||||||
if(user == null)
|
if(user == null)
|
||||||
return "redirect:/";
|
return "redirect:/";
|
||||||
Guild guild = MainBot.jda.getGuildById(guildId);
|
GeneralWebView.addGuildAndRedirect(model, token, guildId, user.getMutualGuilds());
|
||||||
if(guild != null)
|
|
||||||
model.addAttribute("guild_name", guild.getName());
|
|
||||||
else
|
|
||||||
model.addAttribute("guild_name", "");
|
|
||||||
model.addAttribute("isAdmin", SettingsUtils.getInstance().checkPermission(token, guildId));
|
|
||||||
return CheckPage.getPageIfReady("music");
|
return CheckPage.getPageIfReady("music");
|
||||||
|
|
||||||
} catch (UnknownTokenException e) {
|
} catch (UnknownTokenException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user