move extension functions to methods

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-06-23 20:18:45 +02:00
parent 223bc6302c
commit 2a0ee1c90d
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B

View File

@ -55,22 +55,14 @@ data class UserNgEntity(
fun hasSpreedFeatureCapability(capabilityName: String): Boolean {
return capabilities?.spreedCapability?.features?.contains(capabilityName) ?: false
}
}
fun UserNgEntity.canUserCreateGroupConversations(): Boolean {
val canCreateValue = capabilities?.spreedCapability?.config?.get("conversations")?.get("can-create")
canCreateValue?.let {
return it.toBoolean()
fun canUserCreateGroupConversations(): Boolean {
val canCreateValue = capabilities?.spreedCapability?.config?.get("conversations")?.get("can-create")
canCreateValue?.let {
return it.toBoolean()
}
return true
}
return true
}
fun UserNgEntity.toUser(): User {
return User(
this.id, this.userId, this.username, this.baseUrl, this.token, this.displayName, this.pushConfigurationState,
this.capabilities, this.clientCertificate, this.externalSignalingServer, this.current,
this.scheduledForDeletion
)
fun getCredentials(): String = ApiUtils.getCredentials(username, token)
}
fun UserNgEntity.getCredentials(): String = ApiUtils.getCredentials(username, token)