Skip to content

Commit 99807fc

Browse files
cristianscheidnextcloud-command
authored andcommitted
feat(recent-search): pass recent_limit config value to getRecentSearch function
feat(recent-search): pass recent_limit config value to getRecentSearch function Signed-off-by: Cristian Scheid <cristianscheid@gmail.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
1 parent fcc5816 commit 99807fc

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

apps/files/src/services/Recent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import type { FileStat, ResponseDataDetailed, SearchResult } from 'webdav'
77

88
import { getCurrentUser } from '@nextcloud/auth'
99
import { Folder, Permission, davGetRecentSearch, davRootPath, davRemoteURL, davResultToNode } from '@nextcloud/files'
10+
import { loadState } from '@nextcloud/initial-state'
1011
import { CancelablePromise } from 'cancelable-promise'
1112
import { useUserConfigStore } from '../store/userconfig.ts'
1213
import { getPinia } from '../store/index.ts'
1314
import { client } from './WebdavClient.ts'
1415
import { getBaseUrl } from '@nextcloud/router'
1516

1617
const lastTwoWeeksTimestamp = Math.round((Date.now() / 1000) - (60 * 60 * 24 * 14))
18+
const recentLimit = loadState<number>('files', 'recent_limit', 100)
1719

1820
/**
1921
* Helper to map a WebDAV result to a Nextcloud node
@@ -48,7 +50,7 @@ export const getContents = (path = '/'): CancelablePromise<ContentsWithRoot> =>
4850
const contentsResponse = await client.search('/', {
4951
signal: controller.signal,
5052
details: true,
51-
data: davGetRecentSearch(lastTwoWeeksTimestamp),
53+
data: davGetRecentSearch(lastTwoWeeksTimestamp, recentLimit),
5254
}) as ResponseDataDetailed<SearchResult>
5355

5456
const contents = contentsResponse.data.results

dist/files-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)