Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new occ commands to manage system-tags for files #48277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

schaarsc
Copy link

Summary

adds the following commands to the files app:

  • files:tag-add <target> <tags> <access>
  • files:tag-delete <target> <tags> <access>
  • files:tag-delete-all <target>

TODO

  • [ ]

Checklist

@szaimen szaimen removed their request for review September 23, 2024 08:34
@szaimen szaimen added enhancement 3. to review Waiting for reviews labels Sep 23, 2024
@szaimen szaimen added this to the Nextcloud 31 milestone Sep 23, 2024
return 1;
}

$tags = $this->systemTagObjectMapper->getTagIdsForObjects($targetNode->getId(), 'files');

Check failure

Code scanning / Psalm

InvalidArgument

Argument 1 of OCP\SystemTag\ISystemTagObjectMapper::getTagIdsForObjects expects array<array-key, mixed>|string, but int provided
->setDescription('Add a system-tag to a file or folder')
->addArgument('target', InputArgument::REQUIRED, "file id or path")
->addArgument('tags', InputArgument::REQUIRED, "Name of the tag(s) to add, comma separated")
->addArgument('access', InputArgument::REQUIRED, 'access level of the tag (public, restricted or invisible)');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels weird that access is required for assigning an existing tag

Copy link
Author

@schaarsc schaarsc Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is required because

  • the same tagName can exist with different access level
  • I want to work around the missing exif support (Show and edit EXIF Tags photos#226) by automatically creating the tags if it does not exist

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to work around the missing exif support (nextcloud/photos#226) by automatically creating the tags if it does not exist

We do support EXIF data, they are currently stored with the FilesMetadata API: https://github.com/nextcloud/photos/blob/f70a0486642e166c69bdd45a480288e05ba5faa9/lib/Listener/ExifMetadataProvider.php

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please replace EXIF with metadata/xmp...

I'm using the exiftool to extract metadata. The tool is able to extract the XMP information and TagsList is part of XMP, not EXIF

ExifMetadataProvider does indeed store the EXIF part of the metadata, but this only includes things like GPS, Time, size,...

* SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files\Command;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These commands should be in the systemtags application, not files.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I can move the commands to tag, if you prefer that.
since the objectType is hardcoded to 'files', I'd suggest

  • tag:files:add
  • tag:files:delete
  • tag:files:delete-all

if that is ok

Resolve nextcloud#32735

Signed-off-by: schaarsc <schaarsc@users.noreply.github.com>
@schaarsc schaarsc force-pushed the feature/32735-occ-add-tag-to-file-master branch from 34cde37 to 819385c Compare September 23, 2024 13:21
Copy link
Contributor

github-actions bot commented Oct 8, 2024

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@skjnldsv skjnldsv removed their request for review October 8, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend occ (tags) with commands to add and remove tags to/from files
4 participants