From 09188aad40f1245fde9e796607ad94849a4fc95e Mon Sep 17 00:00:00 2001 From: Cristian Scheid Date: Fri, 6 Mar 2026 19:02:53 -0300 Subject: [PATCH 1/2] feat(recent-search): add parameter to allow dynamic limit of returned items Signed-off-by: Cristian Scheid --- lib/dav/davProperties.ts | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/lib/dav/davProperties.ts b/lib/dav/davProperties.ts index a302eb86..deb25adf 100644 --- a/lib/dav/davProperties.ts +++ b/lib/dav/davProperties.ts @@ -4,7 +4,6 @@ */ import { getCurrentUser } from '@nextcloud/auth' -import { getCapabilities } from '@nextcloud/capabilities' import { scopedGlobals } from '../globalScope.ts' import logger from '../utils/logger.ts' @@ -123,6 +122,7 @@ export function getFavoritesReport(): string { * Get the SEARCH body to search for recently modified/uploaded files * * @param timestamp Oldest timestamp to include (Unix timestamp) + * @param limit Maximum number of items to return * @example * ```ts * // SEARCH for recent files need a different DAV endpoint @@ -140,10 +140,7 @@ export function getFavoritesReport(): string { * }) as ResponseDataDetailed * ``` */ -export function getRecentSearch(timestamp: number): string { - const capabilities = getCapabilities() as { dav?: { search_supports_upload_time?: boolean } } - const supportsUploadTime = capabilities.dav?.search_supports_upload_time - +export function getRecentSearch(timestamp: number, limit: number = 100): string { return ` @@ -177,31 +174,6 @@ export function getRecentSearch(timestamp: number): string { 0 - ${supportsUploadTime - ? ` - - - - - - ${timestamp} - - - - - - ${timestamp} - - - ` - : ` - - - - - ${timestamp} - - `} @@ -213,7 +185,7 @@ export function getRecentSearch(timestamp: number): string { - 100 + ${limit} 0 From 5aaa694c0462f04f6d7aeec7271e25562e2d6192 Mon Sep 17 00:00:00 2001 From: Cristian Scheid Date: Wed, 25 Mar 2026 13:41:55 -0300 Subject: [PATCH 2/2] refactor(recent-search): bring back timestamp section on where clause Signed-off-by: Cristian Scheid --- lib/dav/davProperties.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/dav/davProperties.ts b/lib/dav/davProperties.ts index deb25adf..81152b9e 100644 --- a/lib/dav/davProperties.ts +++ b/lib/dav/davProperties.ts @@ -4,6 +4,7 @@ */ import { getCurrentUser } from '@nextcloud/auth' +import { getCapabilities } from '@nextcloud/capabilities' import { scopedGlobals } from '../globalScope.ts' import logger from '../utils/logger.ts' @@ -141,6 +142,9 @@ export function getFavoritesReport(): string { * ``` */ export function getRecentSearch(timestamp: number, limit: number = 100): string { + const capabilities = getCapabilities() as { dav?: { search_supports_upload_time?: boolean } } + const supportsUploadTime = capabilities.dav?.search_supports_upload_time + return ` @@ -174,6 +178,31 @@ export function getRecentSearch(timestamp: number, limit: number = 100): string 0 + ${supportsUploadTime + ? ` + + + + + + ${timestamp} + + + + + + ${timestamp} + + + ` + : ` + + + + + ${timestamp} + + `}