mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 12:51:13 +00:00
managers relation is fixed (4x)
This commit is contained in:
@@ -54,7 +54,7 @@ fun Routing.apiCommandRoutes() {
|
||||
return@put
|
||||
}
|
||||
|
||||
if(!user.managers.any { it.naverId == session?.id } && user.naverId != session?.id) {
|
||||
if(!user.managers?.any { it.naverId == session?.id }!! ?: true && user.naverId != session?.id) {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@put
|
||||
}
|
||||
@@ -84,7 +84,7 @@ fun Routing.apiCommandRoutes() {
|
||||
return@post
|
||||
}
|
||||
|
||||
if(!user.managers.any { it.naverId == session?.id } && user.naverId != session?.id) {
|
||||
if(!user.managers?.any { it.naverId == session?.id }!! ?: true && user.naverId != session?.id) {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@post
|
||||
}
|
||||
@@ -119,7 +119,7 @@ fun Routing.apiCommandRoutes() {
|
||||
return@delete
|
||||
}
|
||||
|
||||
if(!user.managers.any { it.naverId == session?.id } && user.naverId != session?.id) {
|
||||
if(!user.managers?.any { it.naverId == session?.id }!! ?: true && user.naverId != session?.id) {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@delete
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ fun Route.apiDiscordRoutes() {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@get
|
||||
}
|
||||
if(!user.managers.any { it.naverId == session?.id } && user.naverId != session?.id) {
|
||||
if(!user.managers?.any { it.naverId == session?.id }!! ?: true && user.naverId != session?.id) {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@get
|
||||
}
|
||||
@@ -58,7 +58,7 @@ fun Route.apiDiscordRoutes() {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@post
|
||||
}
|
||||
if(!user.managers.any { it.naverId == session?.id } && user.naverId != session?.id) {
|
||||
if(!user.managers?.any { it.naverId == session?.id }!! ?: true && user.naverId != session?.id) {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@post
|
||||
}
|
||||
|
@@ -116,8 +116,8 @@ fun Routing.apiRoutes() {
|
||||
songConfig.streamerOnly,
|
||||
songConfig.disabled
|
||||
))
|
||||
|
||||
returnUsers.addAll(user.subordinates.map {
|
||||
val subordinates = user.subordinates ?: emptyList()
|
||||
returnUsers.addAll(subordinates.map {
|
||||
val subStatus = user.token?.let { it1 -> getStreamInfo(it1) }
|
||||
return@map if (it.token == null || subStatus?.content == null) {
|
||||
null
|
||||
|
@@ -27,7 +27,7 @@ fun Routing.apiTimerRoutes() {
|
||||
return@get
|
||||
}
|
||||
|
||||
if(!user.managers.any { it.naverId == session?.id } && user.naverId != session?.id) {
|
||||
if(!user.managers?.any { it.naverId == session?.id }!! ?: true && user.naverId != session?.id) {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@get
|
||||
}
|
||||
@@ -51,7 +51,7 @@ fun Routing.apiTimerRoutes() {
|
||||
return@put
|
||||
}
|
||||
|
||||
if(!user.managers.any { it.naverId == session?.id } && user.naverId != session?.id) {
|
||||
if(!user.managers?.any { it.naverId == session?.id }!! ?: true && user.naverId != session?.id) {
|
||||
call.respond(HttpStatusCode.BadRequest, "User does not exist")
|
||||
return@put
|
||||
}
|
||||
|
Reference in New Issue
Block a user