mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Enhancement kitsu note with exceptions (#4537)
* Enhancement: Allowing kitsu not status exceptions * Update openpype/modules/kitsu/plugins/publish/integrate_kitsu_note.py Co-authored-by: Félix David <felixg.david@gmail.com> * adding equal/not equal option * Making equal/not equal option available at for every list item * Changed into , renamed into , added documentation * Using upper cases during check, so the new settings aren't case sensitive * Linting little detail * Renaming Equality into Condition, new screenshot with both equal and not equal shown on it * Update website/docs/module_kitsu.md README adjustments Co-authored-by: Félix David <felixg.david@gmail.com> * Changes needed to resolve conflict * Changing context into instance where appropriate * Minor change to avoid changing a line that doesn't need to be changed * Turning exceptions into conditions. Making checks positive instead of negative. Changing implementation based on suggestions. --------- Co-authored-by: Félix David <felixg.david@gmail.com>
This commit is contained in:
parent
ec9b6cb56d
commit
6f16f3e4f4
5 changed files with 56 additions and 5 deletions
|
|
@ -14,6 +14,7 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
|
|||
# status settings
|
||||
set_status_note = False
|
||||
note_status_shortname = "wfa"
|
||||
status_conditions = list()
|
||||
|
||||
# comment settings
|
||||
custom_comment_template = {
|
||||
|
|
@ -56,9 +57,19 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
|
|||
|
||||
# Get note status, by default uses the task status for the note
|
||||
# if it is not specified in the configuration
|
||||
note_status = kitsu_task["task_status"]["id"]
|
||||
shortname = kitsu_task["task_status"]["short_name"].upper()
|
||||
note_status = kitsu_task["task_status_id"]
|
||||
|
||||
if self.set_status_note:
|
||||
# Check if any status condition is not met
|
||||
allow_status_change = True
|
||||
for status_cond in self.status_conditions:
|
||||
condition = status_cond["condition"] == "equal"
|
||||
match = status_cond["short_name"].upper() == shortname
|
||||
if match and not condition or condition and not match:
|
||||
allow_status_change = False
|
||||
break
|
||||
|
||||
if self.set_status_note and allow_status_change:
|
||||
kitsu_status = gazu.task.get_task_status_by_short_name(
|
||||
self.note_status_shortname
|
||||
)
|
||||
|
|
@ -82,10 +93,11 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
|
|||
self.log.debug("Comment is `{}`".format(publish_comment))
|
||||
|
||||
# Add comment to kitsu task
|
||||
task_id = kitsu_task["id"]
|
||||
self.log.debug("Add new note in taks id {}".format(task_id))
|
||||
self.log.debug(
|
||||
"Add new note in tasks id {}".format(kitsu_task["id"])
|
||||
)
|
||||
kitsu_comment = gazu.task.add_comment(
|
||||
task_id, note_status, comment=publish_comment
|
||||
kitsu_task, note_status, comment=publish_comment
|
||||
)
|
||||
|
||||
instance.data["kitsu_comment"] = kitsu_comment
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
"IntegrateKitsuNote": {
|
||||
"set_status_note": false,
|
||||
"note_status_shortname": "wfa",
|
||||
"status_conditions": [],
|
||||
"custom_comment_template": {
|
||||
"enabled": false,
|
||||
"comment_template": "{comment}\n\n| | |\n|--|--|\n| version| `{version}` |\n| family | `{family}` |\n| name | `{name}` |"
|
||||
|
|
|
|||
|
|
@ -51,6 +51,32 @@
|
|||
{
|
||||
"type": "text",
|
||||
"key": "note_status_shortname",
|
||||
"label": "Note shortname"
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"key": "status_conditions",
|
||||
"label": "Status conditions",
|
||||
"object_type": {
|
||||
"type": "dict",
|
||||
"key": "conditions_dict",
|
||||
"children": [
|
||||
{
|
||||
"type": "enum",
|
||||
"key": "condition",
|
||||
"label": "Condition",
|
||||
"enum_items": [
|
||||
{"equal": "Equal"},
|
||||
{"not_equal": "Not equal"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"key": "short_name",
|
||||
"label": "Short name"
|
||||
}
|
||||
]
|
||||
},
|
||||
"label": "Status shortname"
|
||||
},
|
||||
{
|
||||
|
|
|
|||
BIN
website/docs/assets/integrate_kitsu_note_settings.png
Normal file
BIN
website/docs/assets/integrate_kitsu_note_settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
|
|
@ -38,6 +38,18 @@ This functionality cannot deal with all cases and is not error proof, some inter
|
|||
openpype_console module kitsu push-to-zou -l me@domain.ext -p my_password
|
||||
```
|
||||
|
||||
## Integrate Kitsu Note
|
||||
Task status can be automatically set during publish thanks to `Integrate Kitsu Note`. This feature can be configured in:
|
||||
|
||||
`Admin -> Studio Settings -> Project Settings -> Kitsu -> Integrate Kitsu Note`.
|
||||
|
||||
There are three settings available:
|
||||
- `Set status on note` -> turns on and off this integrator.
|
||||
- `Note shortname` -> Which status shortname should be set automatically (Case sensitive).
|
||||
- `Status conditions` -> Conditions that need to be met for kitsu status to be changed. You can add as many conditions as you like. There are two fields to each conditions: `Condition` (Whether current status should be equal or not equal to the condition status) and `Short name` (Kitsu Shortname of the condition status).
|
||||
|
||||

|
||||
|
||||
## Q&A
|
||||
### Is it safe to rename an entity from Kitsu?
|
||||
Absolutely! Entities are linked by their unique IDs between the two databases.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue