in src/main/kotlin/jetbrains/buildServer/notification/slackNotifier/SlackNotifierChannelCompletionController.kt [42:64]
override fun getCompletionData(request: HttpServletRequest): List<Completion> {
val term = getParameter(request, "term") ?: return mutableListOf()
val connectionId = getParameter(request, SlackProperties.connectionProperty.key) ?: return mutableListOf()
val connection = projectManager.projects.asSequence().mapNotNull { project ->
oAuthConnectionsManager.findConnectionById(project, connectionId)
}.firstOrNull()
if (connection == null) {
log.warn(
"Can't compute autocompletion because no connection with id '${connectionId}' found"
)
return mutableListOf()
}
val token = connection.parameters["secure:token"]
if (token == null) {
log.warn("Can't compute autocompletion because no 'secure:token' property is found in connection with id '${connectionId}'")
return mutableListOf()
}
return getCompletion(term, token)
}