Skip to content

Commit 683a4ee

Browse files
authored
Merge pull request #1553 from nextcloud-libraries/backport/1527/stable3
[stable3] feat(recent-search): add parameter to allow dynamic limit of returned items
2 parents 41e5dd6 + 3f2682b commit 683a4ee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/dav/davProperties.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export const getFavoritesReport = function(): string {
128128
* Get the SEARCH body to search for recently modified files
129129
*
130130
* @param lastModified Oldest timestamp to include (Unix timestamp)
131+
* @param limit Maximum number of items to return
131132
* @example
132133
* ```ts
133134
* // SEARCH for recent files need a different DAV endpoint
@@ -145,7 +146,7 @@ export const getFavoritesReport = function(): string {
145146
* }) as ResponseDataDetailed<FileStat[]>
146147
* ```
147148
*/
148-
export const getRecentSearch = function(lastModified: number): string {
149+
export const getRecentSearch = function(lastModified: number, limit: number = 100): string {
149150
return `<?xml version="1.0" encoding="UTF-8"?>
150151
<d:searchrequest ${getDavNameSpaces()}
151152
xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
@@ -196,7 +197,7 @@ export const getRecentSearch = function(lastModified: number): string {
196197
</d:order>
197198
</d:orderby>
198199
<d:limit>
199-
<d:nresults>100</d:nresults>
200+
<d:nresults>${limit}</d:nresults>
200201
<ns:firstresult>0</ns:firstresult>
201202
</d:limit>
202203
</d:basicsearch>

0 commit comments

Comments
 (0)