Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Hide .mov for live photos
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Nov 9, 2023
commit 1c84139fa6d2803d7b555dbedfda8bba8067a5ed
7 changes: 7 additions & 0 deletions apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class FilesPlugin extends ServerPlugin {
public const SUBFOLDER_COUNT_PROPERTYNAME = '{http://nextcloud.org/ns}contained-folder-count';
public const SUBFILE_COUNT_PROPERTYNAME = '{http://nextcloud.org/ns}contained-file-count';
public const FILE_METADATA_PREFIX = '{http://nextcloud.org/ns}metadata-';
public const HIDDEN_PROPERTYNAME = '{http://nextcloud.org/ns}hidden';

/** Reference to main server object */
private ?Server $server = null;
Expand Down Expand Up @@ -386,6 +387,12 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
$propFind->handle(self::FILE_METADATA_PREFIX . $metadataKey, $metadataValue);
}

$propFind->handle(self::HIDDEN_PROPERTYNAME, function () use ($node) {
$filesMetadataManager = \OCP\Server::get(IFilesMetadataManager::class);
$metadata = $filesMetadataManager->getMetadata((int)$node->getFileId(), true);
return $metadata->hasKey('files-live-photo') && $node->getFileInfo()->getMimetype() === 'video/quicktime' ? 'true' : 'false';
});

/**
* Return file/folder name as displayname. The primary reason to
* implement it this way is to avoid costly fallback to
Expand Down
8 changes: 7 additions & 1 deletion apps/files/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/
import MenuIcon from '@mdi/svg/svg/sun-compass.svg?raw'
import { FileAction, addNewFileMenuEntry, registerFileAction } from '@nextcloud/files'
import { FileAction, addNewFileMenuEntry, registerDavProperty, registerFileAction } from '@nextcloud/files'

import { action as deleteAction } from './actions/deleteAction'
import { action as downloadAction } from './actions/downloadAction'
Expand All @@ -41,6 +41,8 @@ import registerPreviewServiceWorker from './services/ServiceWorker.js'

import './init-templates'

import { initLivePhotos } from './services/LivePhotos'

// Register file actions
registerFileAction(deleteAction)
registerFileAction(downloadAction)
Expand All @@ -63,3 +65,7 @@ registerRecentView()

// Register preview service worker
registerPreviewServiceWorker()

registerDavProperty('nc:hidden', { nc: 'http://nextcloud.org/ns' })

initLivePhotos()
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
/*!
* vue-qrcode v1.0.2
* https://fengyuanchen.github.io/vue-qrcode
*
* Copyright 2018-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2020-01-18T06:04:33.222Z
*/

/**
* @copyright 2019 Christoph Wurst <[email protected]>
* @copyright Copyright (c) 2023 Louis Chmn <[email protected]>
*
* @author Christoph Wurst <[email protected]>
* @author John Molakvoæ <[email protected]>
* @author Louis Chmn <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -30,3 +19,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import { Node, registerDavProperty } from '@nextcloud/files'

export function initLivePhotos(): void {
registerDavProperty('nc:metadata-files-live-photo', { nc: 'http://nextcloud.org/ns' })
}

/**
* @param {Node} node - The node
*/
export function isLivePhoto(node: Node): boolean {
return node.attributes['metadata-files-live-photo'] !== null
}
5 changes: 4 additions & 1 deletion apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ export default Vue.extend({
},
dirContents(): Node[] {
return (this.currentFolder?._children || []).map(this.getNode).filter(file => file)
return (this.currentFolder?._children || [])
.map(this.getNode)
.filter(file => file)
.filter(file => file?.attributes?.hidden !== true)
},
/**
Expand Down