mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 20:07:05 +03:00
Fix groups not transferring when merging tags (#6127)
* Add test for group when merging tags * Fix groups not reallocated when merging tags
This commit is contained in:
@@ -790,6 +790,7 @@ func (qb *TagStore) Merge(ctx context.Context, source []int, destination int) er
|
||||
imagesTagsTable: imageIDColumn,
|
||||
"performers_tags": "performer_id",
|
||||
"studios_tags": "studio_id",
|
||||
groupsTagsTable: "group_id",
|
||||
}
|
||||
|
||||
args = append(args, destination)
|
||||
|
||||
@@ -931,6 +931,8 @@ func TestTagMerge(t *testing.T) {
|
||||
tagIdxWithGallery,
|
||||
tagIdx1WithGallery,
|
||||
tagIdx2WithGallery,
|
||||
tagIdx1WithGroup,
|
||||
tagIdx2WithGroup,
|
||||
}
|
||||
var srcIDs []int
|
||||
for _, idx := range srcIdxs {
|
||||
@@ -1024,6 +1026,18 @@ func TestTagMerge(t *testing.T) {
|
||||
|
||||
assert.Contains(studioTagIDs, destID)
|
||||
|
||||
// ensure group points to new tag
|
||||
group, err := db.Group.Find(ctx, groupIDs[groupIdxWithTwoTags])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := group.LoadTagIDs(ctx, db.Group); err != nil {
|
||||
return err
|
||||
}
|
||||
groupTagIDs := group.TagIDs.List()
|
||||
|
||||
assert.Contains(groupTagIDs, destID)
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
t.Error(err.Error())
|
||||
|
||||
Reference in New Issue
Block a user