Merge tags functionality (#1481)

* Add API to merge tags

Add new API endpoint, `tagsMerge(source, destination)` to merge multiple
tags into a single one. The "sources" must be provided as a list of ids
and the destination as a single id. All usages of the source tags
(scenes, markers (primary and additional), images, galleries and
performers) will be updated to the destination tag, all aliases of the
source tags will be updated to the destination, and the name of the
source will be added as alias to the destination as well.

* Add merge tag UI
* Add unit tests
* Update test mocks
* Update internationalisation
* Add changelog entry

Co-authored-by: gitgiggety <gitgiggety@outlook.com>
This commit is contained in:
WithoutPants
2021-06-16 14:33:54 +10:00
committed by GitHub
parent 45f4a5ba81
commit 4fe4da6c01
18 changed files with 468 additions and 14 deletions

View File

@@ -5,6 +5,7 @@ package sqlite_test
import (
"context"
"database/sql"
"errors"
"fmt"
"io/ioutil"
"os"
@@ -342,6 +343,16 @@ func withTxn(f func(r models.Repository) error) error {
return t.WithTxn(context.TODO(), f)
}
func withRollbackTxn(f func(r models.Repository) error) error {
var ret error
withTxn(func(repo models.Repository) error {
ret = f(repo)
return errors.New("fake error for rollback")
})
return ret
}
func testTeardown(databaseFile string) {
err := database.DB.Close()