-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(tags): tag system with explorer integration, and media context menu fixes #3044
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
Closed
slvnlrt
wants to merge
22
commits into
spacedriveapp:spacedrive-data
from
slvnlrt:tags-and-media-fixes
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
873b89d
fix(search): apply TagFilter in search.files query
slvnlrt a9dde16
feat(tags): implement tags.by_id, tags.ancestors, tags.children, file…
slvnlrt 1bc19a3
fix(tags): prevent duplicate tag applications on the same file
slvnlrt b4415cd
fix(tags,ui): make tag view files navigable and wire Overview search …
slvnlrt a096965
feat(tags): render tag view using standard explorer with full File ob…
slvnlrt b414c20
feat(tags): add unapply/delete actions, fix tag sync and Inspector UX
slvnlrt 6529043
refactor: extract shared useRefetchTagQueries hook
slvnlrt c61d036
fix(core): use current device slug instead of \"unknown-device\" fall…
slvnlrt ff449d0
fix(media): replace broken useJobDispatch with direct mutations
slvnlrt d59ef2a
fix(tags): address CodeRabbit review findings on tag system
slvnlrt c02bfa7
fix(migration): keep newest row (MAX id) when deduplicating tag appli…
slvnlrt 16daa27
revert(tags): restore independent tagModeActive state
slvnlrt a3edd3c
fix(tags): address second round of CodeRabbit review
slvnlrt 4022524
fix(tags): skip rows with undecodable required fields instead of fabr…
slvnlrt 93ccb62
fix(tags): remove broken optimistic update and alert() dialog
slvnlrt c0efb33
fix(tags): emit file events on tag delete, refetch files.by_id for in…
slvnlrt 0b75b82
fix(tags): add extension to root-level file paths, validate entry UUIDs
slvnlrt ed9890a
fix(tags): pre-index content rows to avoid O(n²) tag merge, require e…
slvnlrt 4ad8df6
fix(tags): secure FTS5 escaping, batch entry lookups for performance
slvnlrt 637a941
chore: remove dead useJobDispatch hook
slvnlrt 9295f85
fix(tags): remove redundant inline sea_orm imports
slvnlrt dea06b9
fix(tags): validate entry UUIDs in create action before applying
slvnlrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
core/src/infra/db/migration/m20260125_000001_unique_user_metadata_tag.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| use sea_orm_migration::prelude::*; | ||
|
|
||
| #[derive(DeriveMigrationName)] | ||
| pub struct Migration; | ||
|
|
||
| #[async_trait::async_trait] | ||
| impl MigrationTrait for Migration { | ||
| async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
| let db = manager.get_connection(); | ||
|
|
||
| // Remove duplicate (user_metadata_id, tag_id) pairs, keeping the newest (MAX id) | ||
| // which has the most recent version/updated_at/device_uuid state. | ||
| // This must run before creating the unique index. | ||
| db.execute_unprepared( | ||
| "DELETE FROM user_metadata_tag \ | ||
| WHERE id NOT IN ( \ | ||
| SELECT MAX(id) FROM user_metadata_tag \ | ||
| GROUP BY user_metadata_id, tag_id \ | ||
| )", | ||
| ) | ||
| .await?; | ||
|
|
||
| // Add unique index so the pair can never be duplicated again. | ||
| manager | ||
| .create_index( | ||
| Index::create() | ||
| .if_not_exists() | ||
| .name("idx_umt_unique_pair") | ||
| .table(Alias::new("user_metadata_tag")) | ||
| .col(Alias::new("user_metadata_id")) | ||
| .col(Alias::new("tag_id")) | ||
| .unique() | ||
| .to_owned(), | ||
| ) | ||
| .await?; | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
| manager | ||
| .drop_index( | ||
| Index::drop() | ||
| .name("idx_umt_unique_pair") | ||
| .table(Alias::new("user_metadata_tag")) | ||
| .to_owned(), | ||
| ) | ||
| .await?; | ||
|
|
||
| Ok(()) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.