Skip to content

Commit 5aaa694

Browse files
refactor(recent-search): bring back timestamp section on where clause
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
1 parent 09188aa commit 5aaa694

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

lib/dav/davProperties.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { getCurrentUser } from '@nextcloud/auth'
7+
import { getCapabilities } from '@nextcloud/capabilities'
78
import { scopedGlobals } from '../globalScope.ts'
89
import logger from '../utils/logger.ts'
910

@@ -141,6 +142,9 @@ export function getFavoritesReport(): string {
141142
* ```
142143
*/
143144
export function getRecentSearch(timestamp: number, limit: number = 100): string {
145+
const capabilities = getCapabilities() as { dav?: { search_supports_upload_time?: boolean } }
146+
const supportsUploadTime = capabilities.dav?.search_supports_upload_time
147+
144148
return `<?xml version="1.0" encoding="UTF-8"?>
145149
<d:searchrequest ${getDavNameSpaces()}
146150
xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
@@ -174,6 +178,31 @@ export function getRecentSearch(timestamp: number, limit: number = 100): string
174178
<d:literal>0</d:literal>
175179
</d:eq>
176180
</d:or>
181+
${supportsUploadTime
182+
? `
183+
<d:or>
184+
<d:gt>
185+
<d:prop>
186+
<d:getlastmodified/>
187+
</d:prop>
188+
<d:literal>${timestamp}</d:literal>
189+
</d:gt>
190+
<d:gt>
191+
<d:prop>
192+
<nc:upload_time/>
193+
</d:prop>
194+
<d:literal>${timestamp}</d:literal>
195+
</d:gt>
196+
</d:or>
197+
`
198+
: `
199+
<d:gt>
200+
<d:prop>
201+
<d:getlastmodified/>
202+
</d:prop>
203+
<d:literal>${timestamp}</d:literal>
204+
</d:gt>
205+
`}
177206
</d:and>
178207
</d:where>
179208
<d:orderby>

0 commit comments

Comments
 (0)