Skip to content

Commit

Permalink
Merge pull request #2251 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
fix: update group application custom content (#2250)
  • Loading branch information
zhu327 authored Sep 5, 2023
2 parents 8109dfc + 1db41c1 commit 768494e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion saas/backend/api/management/v2/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ def validate(self, data):
raise serializers.ValidationError({"content_template": ["content_template中必须包含schemes和form_data"]})
if (
not isinstance(data["content_template"]["form_data"], list)
or len(data["content_template"]["form_data"]) != 0
or len(data["content_template"]["form_data"]) != 1
or "value" not in data["content_template"]["form_data"][0]
or not isinstance(data["content_template"]["form_data"][0]["value"], list)
):
raise serializers.ValidationError({"content_template": ["content_template中必须包含form_data且为空数组"]})

Expand Down
7 changes: 3 additions & 4 deletions saas/backend/biz/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""
import logging
from collections import defaultdict
from copy import deepcopy
from itertools import groupby
from typing import Any, Dict, List, Optional, Tuple, Type

Expand Down Expand Up @@ -709,10 +710,8 @@ def create_for_group(
# 组装外部传入的itsm单据数据
content: Optional[Dict[str, Any]] = None
if content_template and group_content:
content = {
"schemes": content_template["schemes"],
"form_data": [group_content[str(_id)] for _id in group_ids],
}
content = deepcopy(content_template)
content["form_data"][0]["value"] = [group_content[str(_id)] for _id in group_ids]

new_data_list.append((application_data, process, content))

Expand Down

0 comments on commit 768494e

Please sign in to comment.