mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Add Sort Name to Tags (#5531)
* override "name" sort with COALESCE * tag sort_name frontend adds `data-sort-name` attribute to tag links prioritizes sort_name value but will default to tag name if not present in the same way that COALESCE will prioritize the same values in the same way * add sort_name filter, update locale per request * Include sort name in anonymiser * Add import/export support --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -21,6 +21,7 @@ type FinderAliasImageGetter interface {
|
||||
func ToJSON(ctx context.Context, reader FinderAliasImageGetter, tag *models.Tag) (*jsonschema.Tag, error) {
|
||||
newTagJSON := jsonschema.Tag{
|
||||
Name: tag.Name,
|
||||
SortName: tag.SortName,
|
||||
Description: tag.Description,
|
||||
Favorite: tag.Favorite,
|
||||
IgnoreAutoTag: tag.IgnoreAutoTag,
|
||||
|
||||
@@ -24,6 +24,7 @@ const (
|
||||
|
||||
const (
|
||||
tagName = "testTag"
|
||||
sortName = "sortName"
|
||||
description = "description"
|
||||
)
|
||||
|
||||
@@ -37,6 +38,7 @@ func createTag(id int) models.Tag {
|
||||
return models.Tag{
|
||||
ID: id,
|
||||
Name: tagName,
|
||||
SortName: sortName,
|
||||
Favorite: true,
|
||||
Description: description,
|
||||
IgnoreAutoTag: autoTagIgnored,
|
||||
@@ -48,6 +50,7 @@ func createTag(id int) models.Tag {
|
||||
func createJSONTag(aliases []string, image string, parents []string) *jsonschema.Tag {
|
||||
return &jsonschema.Tag{
|
||||
Name: tagName,
|
||||
SortName: sortName,
|
||||
Favorite: true,
|
||||
Description: description,
|
||||
Aliases: aliases,
|
||||
|
||||
@@ -38,6 +38,7 @@ type Importer struct {
|
||||
func (i *Importer) PreImport(ctx context.Context) error {
|
||||
i.tag = models.Tag{
|
||||
Name: i.Input.Name,
|
||||
SortName: i.Input.SortName,
|
||||
Description: i.Input.Description,
|
||||
Favorite: i.Input.Favorite,
|
||||
IgnoreAutoTag: i.Input.IgnoreAutoTag,
|
||||
|
||||
@@ -40,6 +40,7 @@ func TestImporterPreImport(t *testing.T) {
|
||||
i := Importer{
|
||||
Input: jsonschema.Tag{
|
||||
Name: tagName,
|
||||
SortName: sortName,
|
||||
Description: description,
|
||||
Image: invalidImage,
|
||||
IgnoreAutoTag: autoTagIgnored,
|
||||
|
||||
Reference in New Issue
Block a user