Skip to content

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
@skjnldsv
Copy link
Member

What's the status @kesselb ?

@skjnldsv
Copy link
Member

Ping @kesselb 🙇

@kesselb kesselb removed this from the Nextcloud 32 milestone Jul 24, 2025
@kesselb
Copy link
Contributor Author

kesselb commented Jul 24, 2025

Huhu, sorry for not getting back to you earlier 🙈

I realized while working on it that adding that index on existing systems and ironing out the various issues I ran into while diving through the code needs more work. So I had the idea to hand it over to the files team. However, I don’t remember if I actually spoke with Christoph about it. I let him know now.

@skjnldsv skjnldsv self-assigned this Jul 28, 2025
@susnux susnux deleted the bug/49395/handle-multiple-tags branch November 1, 2025 11:24
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.

4 participants