Skip to content

Commit aa20db2

Browse files
authored
Merge pull request #1527 from nextcloud-libraries/feat/1700/limit-recent-files
feat(recent-search): add parameter to allow dynamic limit of returned items
2 parents b73e855 + 5aaa694 commit aa20db2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/dav/davProperties.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export function getFavoritesReport(): string {
123123
* Get the SEARCH body to search for recently modified/uploaded files
124124
*
125125
* @param timestamp Oldest timestamp to include (Unix timestamp)
126+
* @param limit Maximum number of items to return
126127
* @example
127128
* ```ts
128129
* // SEARCH for recent files need a different DAV endpoint
@@ -140,7 +141,7 @@ export function getFavoritesReport(): string {
140141
* }) as ResponseDataDetailed<FileStat[]>
141142
* ```
142143
*/
143-
export function getRecentSearch(timestamp: number): string {
144+
export function getRecentSearch(timestamp: number, limit: number = 100): string {
144145
const capabilities = getCapabilities() as { dav?: { search_supports_upload_time?: boolean } }
145146
const supportsUploadTime = capabilities.dav?.search_supports_upload_time
146147

@@ -213,7 +214,7 @@ export function getRecentSearch(timestamp: number): string {
213214
</d:order>
214215
</d:orderby>
215216
<d:limit>
216-
<d:nresults>100</d:nresults>
217+
<d:nresults>${limit}</d:nresults>
217218
<ns:firstresult>0</ns:firstresult>
218219
</d:limit>
219220
</d:basicsearch>

0 commit comments

Comments
 (0)