File tree Expand file tree Collapse file tree 3 files changed +16
-38
lines changed
nextcloud/client/database/dao Expand file tree Collapse file tree 3 files changed +16
-38
lines changed Original file line number Diff line number Diff line change @@ -122,16 +122,16 @@ interface FileDao {
122122 """
123123 SELECT *
124124 FROM filelist
125- WHERE file_owner = :fileOwner
126- AND (
127- share_by_link = 1
128- OR shared_via_users = 1
129- OR permissions LIKE '%S%'
130- )
125+ WHERE
126+ (file_owner != :accountName
127+ OR share_by_link = 1
128+ OR shared_via_users = 1
129+ OR permissions LIKE '%S%')
130+ AND parent = 1
131131 ORDER BY ${ProviderTableMeta .FILE_DEFAULT_SORT_ORDER }
132132 """
133133 )
134- suspend fun getSharedFiles (fileOwner : String ): List <FileEntity >
134+ suspend fun getSharedFiles (accountName : String ): List <FileEntity >
135135
136136 @Query(
137137 """
Original file line number Diff line number Diff line change @@ -59,24 +59,7 @@ object OCShareToOCFileConverter {
5959 return @withContext emptyList()
6060 }
6161
62- val cachedPaths = cachedFiles.map { it.decryptedRemotePath }.toSet()
63-
64- // Group shares by path to identify unique files
65- val sharesByPath = shares
66- .filter { it.path != null }
67- .groupBy { it.path!! }
68-
69- // Identify ONLY new file paths that aren't in cache
70- val newSharesByPath = sharesByPath.filterKeys { path ->
71- path !in cachedPaths
72- }
73-
74- if (newSharesByPath.isEmpty()) {
75- return @withContext cachedFiles
76- }
77-
78- val newShares = newSharesByPath.values.flatten()
79- val newFiles = buildOCFilesFromShares(newShares)
62+ val newFiles = buildOCFilesFromShares(shares)
8063 val baseSavePath = FileStorageUtils .getSavePath(accountName)
8164
8265 val resolvedNewFiles = newFiles.map { file ->
@@ -94,7 +77,7 @@ object OCShareToOCFileConverter {
9477 }
9578 }.awaitAll()
9679
97- storageManager?.saveShares(newShares, accountName)
80+ // storageManager?.saveShares(newShares, accountName)
9881 cachedFiles + resolvedNewFiles
9982 }
10083
Original file line number Diff line number Diff line change @@ -128,18 +128,13 @@ class OCFileListSearchTask(
128128
129129 private suspend fun loadCachedDbFiles (searchType : SearchRemoteOperation .SearchType ): List <OCFile > {
130130 val storage = fileDataStorageManager ? : return emptyList()
131-
132- val rows = when (searchType) {
133- SearchRemoteOperation .SearchType .SHARED_FILTER ->
134- storage.fileDao.getSharedFiles(currentUser.accountName)
135-
136- SearchRemoteOperation .SearchType .FAVORITE_SEARCH ->
137- storage.fileDao.getFavoriteFiles(currentUser.accountName)
138-
139- else -> null
140- } ? : return emptyList()
141-
142- return rows.mapNotNull { storage.createFileInstance(it) }
131+ return if (searchType == SearchRemoteOperation .SearchType .SHARED_FILTER ) {
132+ storage.fileDao
133+ .getSharedFiles(currentUser.accountName)
134+ } else {
135+ storage.fileDao
136+ .getFavoriteFiles(currentUser.accountName)
137+ } .mapNotNull { storage.createFileInstance(it) }
143138 }
144139
145140 @Suppress(" DEPRECATION" )
You can’t perform that action at this time.
0 commit comments