Skip to content

BugFix - Do not Filter Share Type #1741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class WebdavEntry constructor(
var unreadCommentsCount = 0
var isHasPreview = false
var note = ""
var sharees = arrayOfNulls<ShareeUser>(0)
var sharees = arrayOf<ShareeUser>()
var richWorkspace: String? = null
var isLocked = false
private set
Expand Down Expand Up @@ -374,22 +374,18 @@ class WebdavEntry constructor(
if (prop != null && prop.value != null) {
if (prop.value is ArrayList<*>) {
val list = prop.value as ArrayList<*>
val tempList: MutableList<ShareeUser?> = ArrayList()
val tempList: MutableList<ShareeUser> = ArrayList()
for (i in list.indices) {
val element = list[i] as Element
val user = createShareeUser(element)
if (user != null) {
tempList.add(user)
}
tempList.add(user)
}
sharees = tempList.toTypedArray()
} else {
// single item or empty
val element = prop.value as Element
val user = createShareeUser(element)
if (user != null) {
sharees = arrayOf(user)
}
sharees = arrayOf(user)
}
}

Expand Down Expand Up @@ -548,20 +544,11 @@ class WebdavEntry constructor(
return stringValue?.toLong() ?: 0L
}

private fun createShareeUser(element: Element): ShareeUser? {
private fun createShareeUser(element: Element): ShareeUser {
val displayName = extractDisplayName(element)
val userId = extractUserId(element)
val shareType = extractShareType(element)
val isSupportedShareType =
ShareType.EMAIL == shareType ||
ShareType.FEDERATED == shareType ||
ShareType.GROUP == shareType ||
ShareType.ROOM == shareType
return if ((isSupportedShareType || displayName.isNotEmpty()) && userId.isNotEmpty()) {
ShareeUser(userId, displayName, shareType)
} else {
null
}
return ShareeUser(userId, displayName, shareType)
}

private fun extractDisplayName(element: Element): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class RemoteFile :
var unreadCommentsCount = 0
var isHasPreview = false
var note: String? = null
var sharees: Array<ShareeUser?>? = null
var sharees: Array<ShareeUser>? = null
var richWorkspace: String? = null
var isLocked = false
var lockType: FileLockType? = null
Expand Down
Loading