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

Handle tags with the same name gracefully #49674

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kesselb
Copy link
Contributor

@kesselb kesselb commented Dec 5, 2024

Summary

We received a report that some files marked as favorites are not displayed in the "Favorites" view. Additionally, users cannot remove the favorite state from these files. This issue is similar to #49395.

Root Cause

  • The lib/private/Tags.php implementation does not properly verify if a given tag already exists. Although a check exists, the list of tags is loaded only once and never updated.
  • The database table lacks a unique constraint, allowing multiple identical tags for the same user.

Proposed Solution

To avoid requiring a migration path for existing tags, I adjusted the code to handle tags with the same name gracefully.

Commit: "vobjects may contain the same tag with different ids"

  • Resolves the display issue by using a subselect to find all tag IDs associated with a name and fetching the relevant objects.

Commit: "add mapper for vcategory_to_object"

  • Introduces a TagRelation and TagRelationMapper to clean up the codebase and address the deletion issue.
  • This makes it possible to delete mappings for multiple categorieid values, which previously only targeted the first ID.

Current Status

The implementation requires additional work to fully resolve the deletion issue. However, due to higher-priority tickets, we are unable to allocate further time to this effort at the moment.

Checklist

It's possible that tags with the same category exist with different ids because there's no unique index on the database.

How to reproduce:

- Remove the favorite tag
- Select 2 or more files
- Tag as favorite (with the batch action)

Signed-off-by: Daniel Kesselberg <[email protected]>
@kesselb kesselb added bug 2. developing Work in progress labels Dec 5, 2024
@kesselb kesselb added this to the Nextcloud 31 milestone Dec 5, 2024
@kesselb kesselb changed the title Bug/49395/handle multiple tags Handle tags with the same name gracefully Dec 5, 2024
@blizzz blizzz mentioned this pull request Jan 8, 2025
This was referenced Jan 14, 2025
This was referenced Jan 21, 2025
@blizzz blizzz mentioned this pull request Jan 29, 2025
1 task
@blizzz blizzz modified the milestones: Nextcloud 31, Nextcloud 32 Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants