Fixed tag removal issue.
This commit is contained in:
parent
378d6eb836
commit
92d6a31aa9
|
@ -798,7 +798,6 @@ func HandleSnippetForInternedMessage(ctx context.Context, dbConn db.ConnOrTx, in
|
|||
var desiredTags []int
|
||||
var allTags []int
|
||||
|
||||
if len(messageTags) > 0 {
|
||||
// Fetch projects so we know what tags the user can apply to their snippet.
|
||||
projects, err := hmndata.FetchProjects(ctx, tx, interned.HMNUser, hmndata.ProjectsQuery{
|
||||
OwnerIDs: []int{interned.HMNUser.ID},
|
||||
|
@ -832,14 +831,13 @@ func HandleSnippetForInternedMessage(ctx context.Context, dbConn db.ConnOrTx, in
|
|||
|
||||
for _, itag := range iUserTags {
|
||||
tag := itag.(*tagsRow).Tag
|
||||
for _, messageTag := range messageTags {
|
||||
allTags = append(allTags, tag.ID)
|
||||
for _, messageTag := range messageTags {
|
||||
if strings.EqualFold(tag.Text, messageTag) {
|
||||
desiredTags = append(desiredTags, tag.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_, err = tx.Exec(ctx,
|
||||
`
|
||||
|
|
|
@ -463,7 +463,7 @@ func SetProjectTag(
|
|||
IncludeHidden: true,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, oops.New(err, "Failed to fetch project")
|
||||
}
|
||||
|
||||
var resultTag *models.Tag
|
||||
|
|
|
@ -760,7 +760,10 @@ func updateProject(ctx context.Context, tx pgx.Tx, user *models.User, payload *P
|
|||
return oops.New(err, "Failed to update project")
|
||||
}
|
||||
|
||||
hmndata.SetProjectTag(ctx, tx, payload.ProjectID, payload.Tag)
|
||||
_, err = hmndata.SetProjectTag(ctx, tx, payload.ProjectID, payload.Tag)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if user.IsStaff {
|
||||
_, err = tx.Exec(ctx,
|
||||
|
|
Loading…
Reference in New Issue