From 92a5d96d3b32e64bec49026f1246008d2e37b883 Mon Sep 17 00:00:00 2001 From: SmallCoccinelle <89733524+SmallCoccinelle@users.noreply.github.com> Date: Fri, 19 Nov 2021 01:12:34 +0100 Subject: [PATCH] Add a TagMergePost post-hook (#2010) * Add a TagMergePost post-hook Introduce a post-hook for merging tags, call it in the merge path, as the last thing we do before returning. --- pkg/api/resolver_mutation_tag.go | 1 + pkg/plugin/hooks.go | 2 ++ ui/v2.5/src/components/Changelog/versions/v0120.md | 3 +++ ui/v2.5/src/docs/en/Plugins.md | 1 + 4 files changed, 7 insertions(+) diff --git a/pkg/api/resolver_mutation_tag.go b/pkg/api/resolver_mutation_tag.go index 23fefaa88..6b9cc14d2 100644 --- a/pkg/api/resolver_mutation_tag.go +++ b/pkg/api/resolver_mutation_tag.go @@ -347,5 +347,6 @@ func (r *mutationResolver) TagsMerge(ctx context.Context, input models.TagsMerge return nil, err } + r.hookExecutor.ExecutePostHooks(ctx, t.ID, plugin.TagMergePost, input, nil) return t, nil } diff --git a/pkg/plugin/hooks.go b/pkg/plugin/hooks.go index 9ff83f06f..6267c994f 100644 --- a/pkg/plugin/hooks.go +++ b/pkg/plugin/hooks.go @@ -40,6 +40,7 @@ const ( TagCreatePost HookTriggerEnum = "Tag.Create.Post" TagUpdatePost HookTriggerEnum = "Tag.Update.Post" + TagMergePost HookTriggerEnum = "Tag.Merge.Post" TagDestroyPost HookTriggerEnum = "Tag.Destroy.Post" ) @@ -74,6 +75,7 @@ var AllHookTriggerEnum = []HookTriggerEnum{ TagCreatePost, TagUpdatePost, + TagMergePost, TagDestroyPost, } diff --git a/ui/v2.5/src/components/Changelog/versions/v0120.md b/ui/v2.5/src/components/Changelog/versions/v0120.md index aa248ac68..39f0f314d 100644 --- a/ui/v2.5/src/components/Changelog/versions/v0120.md +++ b/ui/v2.5/src/components/Changelog/versions/v0120.md @@ -1,2 +1,5 @@ +### 🎨 Improvements +* Added plugin hook for Tag merge operation. ([#2010](https://github.com/stashapp/stash/pull/2010)) + ### 🐛 Bug fixes * Fix "Custom Performer Images" feature picking up non-image files. ([#2017](https://github.com/stashapp/stash/pull/2017)) diff --git a/ui/v2.5/src/docs/en/Plugins.md b/ui/v2.5/src/docs/en/Plugins.md index 223b10a70..fbb224fcb 100644 --- a/ui/v2.5/src/docs/en/Plugins.md +++ b/ui/v2.5/src/docs/en/Plugins.md @@ -125,6 +125,7 @@ The following operations are supported: * `Create` * `Update` * `Destroy` +* `Merge` (for `Tag` only) Currently, only `Post` hook types are supported. These are executed after the operation has completed and the transaction is committed.