in space-slack-sync/src/main/kotlin/org/jetbrains/spaceSlackSync/homepage/StopSyncService.kt [8:31]
suspend fun stopSync(spaceChannelId: String, slackTeamId: String, slackChannelId: String): StopSyncResponse {
db.syncedChannels.getByIds(
spaceTokenInfo.spaceAppInstance.clientId,
spaceChannelId,
slackTeamId,
slackChannelId
)?.let {
// if (!userHasAdminPermission(spaceChannelId)) {
// return StopSyncResponse(
// success = false,
// "Only a channel administrator can stop synchronization for that channel"
// )
// }
db.syncedChannels.remove(
spaceTokenInfo.spaceAppInstance.clientId,
spaceChannelId,
slackTeamId,
slackChannelId
)
return StopSyncResponse(success = true)
}
return StopSyncResponse(success = false, message = "Could not find the synced channel to remove")
}