mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01: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:
parent
2ed9e5332d
commit
72c9c436be
2 changed files with 15 additions and 0 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in a new issue