minor refactor

This commit is contained in:
Ryan ZHAO
2021-03-11 14:45:08 +11:00
parent 42c7f440e9
commit d7124c3b7e
2 changed files with 9 additions and 9 deletions

View File

@@ -41,6 +41,7 @@ object OpenGroupAPI: DotNetAPI() {
return listOf() // Don't auto-join any open groups right now
}
@JvmStatic
fun isUserModerator(hexEncodedPublicKey: String, channel: Long, server: String): Boolean {
if (moderators[server] != null && moderators[server]!![channel] != null) {
return moderators[server]!![channel]!!.contains(hexEncodedPublicKey)
@@ -237,6 +238,7 @@ object OpenGroupAPI: DotNetAPI() {
}
}
@JvmStatic
fun deleteMessages(messageServerIDs: List<Long>, channel: Long, server: String, isSentByUser: Boolean): Promise<List<Long>, Exception> {
return retryIfNeeded(maxRetryCount) {
val isModerationRequest = !isSentByUser
@@ -337,6 +339,7 @@ object OpenGroupAPI: DotNetAPI() {
}
}
@JvmStatic
fun ban(publicKey: String, server: String): Promise<Unit,Exception> {
return retryIfNeeded(maxRetryCount) {
execute(HTTPVerb.POST, server, "/loki/v1/moderation/blacklist/@$publicKey").then {