Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FWF-3921 [bugfix] Showing Save changes everytime #2346

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
notify:
runs-on: ubuntu-latest
if: github.event.pull_request.base.repo.full_name == 'AOT-Technologies/forms-flow-ai'
if: ${{ github.event.pull_request.base.repo.full_name == 'AOT-Technologies/forms-flow-ai' && github.event.pull_request.draft == false }}

steps:
- name: Determine PR Status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,20 @@ def check_tenant_authorization(mapper_id: int, **kwargs) -> int:

@staticmethod
@user_context
def check_tenant_authorization_by_formid(form_id: int, **kwargs) -> int:
def check_tenant_authorization_by_formid(
form_id: int, mapper_data=None, **kwargs
) -> int:
"""Check if tenant has permission to access the resource."""
user: UserContext = kwargs["user"]
tenant_key = user.tenant_key
if tenant_key is None:
return
mapper = FormProcessMapper.find_form_by_form_id(form_id=form_id)
# If mapper data is provided as an argument, there's no need to fetch it from the database
mapper = (
mapper_data
if mapper_data
else FormProcessMapper.find_form_by_form_id(form_id=form_id)
)
if mapper is not None and mapper.tenant != tenant_key:
raise BusinessException(BusinessErrorCode.PERMISSION_DENIED)
return
Expand Down Expand Up @@ -323,10 +330,16 @@ def mapper_create(mapper_json):
@staticmethod
def form_design_update(data, form_id):
"""Service to handle form design update."""
FormProcessMapperService.check_tenant_authorization_by_formid(form_id=form_id)
mapper = FormProcessMapper.find_form_by_form_id(form_id=form_id)
FormProcessMapperService.check_tenant_authorization_by_formid(
form_id=form_id, mapper_data=mapper
)
formio_service = FormioService()
form_io_token = formio_service.get_formio_access_token()
response = formio_service.update_form(form_id, data, form_io_token)
# if user selected to continue with minor version after unpublish
if mapper.prompt_new_version:
mapper.update({"prompt_new_version": False})
FormHistoryService.create_form_log_with_clone(data=data)
return response

Expand Down Expand Up @@ -425,7 +438,6 @@ def create_form(data, is_designer, **kwargs): # pylint:disable=too-many-locals
"resourceDetails": {},
"roles": [],
"userName": user.user_name,

},
"form": {
"resourceId": parent_form_id,
Expand Down
Loading