mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Improve tag alias.
This commit is contained in:
@@ -51,7 +51,7 @@ export default function TaggedResourcesPage() {
|
|||||||
}} />
|
}} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
{tag?.type && <h2 className={"text-base-content/60 ml-2 text-xl pl-2 mb-2"}>{tag.type}</h2>}
|
{tag?.type && <h2 className={"text-base-content/60 ml-2 text-lg pl-2 mb-2"}>{tag.type}</h2>}
|
||||||
<div className={"px-3"}>
|
<div className={"px-3"}>
|
||||||
{
|
{
|
||||||
(tag?.aliases ?? []).map((e) => {
|
(tag?.aliases ?? []).map((e) => {
|
||||||
|
@@ -64,6 +64,13 @@ func GetTagByName(name string) (model.Tag, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SetTagInfo(id uint, description string, aliasOf *uint, tagType string) error {
|
func SetTagInfo(id uint, description string, aliasOf *uint, tagType string) error {
|
||||||
|
old, err := GetTagByID(id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if aliasOf != nil && len(old.Aliases) > 0 {
|
||||||
|
return model.NewRequestError("Tag already has aliases, cannot set alias_of")
|
||||||
|
}
|
||||||
t := model.Tag{Model: gorm.Model{
|
t := model.Tag{Model: gorm.Model{
|
||||||
ID: id,
|
ID: id,
|
||||||
}, Description: description, Type: tagType, AliasOf: aliasOf}
|
}, Description: description, Type: tagType, AliasOf: aliasOf}
|
||||||
|
Reference in New Issue
Block a user