Skip to content

Commit 50e6fb7

Browse files
refactor(recent-search): use d:creationdate instead of c:creation_time and crtime instead of attributes.upload_time
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
1 parent ca67825 commit 50e6fb7

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

apps/dav/lib/Files/FileSearchBackend.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getPropertyDefinitionsForScope(string $href, ?string $path): arr
8686
new SearchPropertyDefinition('{DAV:}displayname', true, true, true),
8787
new SearchPropertyDefinition('{DAV:}getcontenttype', true, true, true),
8888
new SearchPropertyDefinition('{DAV:}getlastmodified', true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME),
89-
new SearchPropertyDefinition('{http://nextcloud.org/ns}creation_time', true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME),
89+
new SearchPropertyDefinition('{DAV:}creationdate', true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME),
9090
new SearchPropertyDefinition('{http://nextcloud.org/ns}upload_time', true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME),
9191
new SearchPropertyDefinition(FilesPlugin::SIZE_PROPERTYNAME, true, true, true, SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
9292
new SearchPropertyDefinition(TagsPlugin::FAVORITE_PROPERTYNAME, true, true, true, SearchPropertyDefinition::DATATYPE_BOOLEAN),
@@ -300,7 +300,7 @@ private function getSearchResultProperty(SearchResult $result, SearchPropertyDef
300300
return $node->getName();
301301
case '{DAV:}getlastmodified':
302302
return $node->getLastModified();
303-
case '{http://nextcloud.org/ns}creation_time':
303+
case '{DAV:}creationdate':
304304
return $node->getNode()->getCreationTime();
305305
case '{http://nextcloud.org/ns}upload_time':
306306
return $node->getNode()->getUploadTime();
@@ -464,7 +464,7 @@ private function mapPropertyNameToColumn(SearchPropertyDefinition $property) {
464464
return 'mimetype';
465465
case '{DAV:}getlastmodified':
466466
return 'mtime';
467-
case '{http://nextcloud.org/ns}creation_time':
467+
case '{DAV:}creationdate':
468468
return 'creation_time';
469469
case '{http://nextcloud.org/ns}upload_time':
470470
return 'upload_time';

apps/files/src/components/FileEntry/FileEntryPreview.vue

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,14 @@ export default defineComponent({
146146
},
147147
148148
isRecentlyCreated(): boolean {
149-
if (this.source.attributes.upload_time) {
150-
return false
151-
}
152-
153-
const creationDate = this.source.attributes.creationdate
154-
? new Date(this.source.attributes.creationdate)
155-
: null
156-
157-
if (!creationDate) {
149+
if (!this.source.crtime) {
158150
return false
159151
}
160152
161153
const oneDayAgo = new Date()
162154
oneDayAgo.setDate(oneDayAgo.getDate() - 1)
163155
164-
return creationDate > oneDayAgo
156+
return this.source.crtime > oneDayAgo
165157
},
166158
167159
isRecentView(): boolean {

0 commit comments

Comments
 (0)