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

Time accounting check crashing when no group is selected #4835

Closed
rolfschmidt opened this issue Sep 22, 2023 · 1 comment
Closed

Time accounting check crashing when no group is selected #4835

rolfschmidt opened this issue Sep 22, 2023 · 1 comment

Comments

@rolfschmidt
Copy link
Collaborator

Used Zammad Version

6.1

Environment

  • Installation method: [e.g. source, package]
  • Operating system (if you're unsure: cat /etc/os-release ): [e.g. debian 10.4, ubuntu 20.04]
  • Database + version: [e.g. postgresql 9.3, mysql 5.7, mariadb 10.3]
  • Elasticsearch version: [e.g. 7.17]
  • Browser + version: [e.g. chrome 83, safari 14, firefox 105]

Actual behaviour

E, [2023-09-22T16:24:51.345929#32187-5700] ERROR -- : Error performing Core Workflow engine.
E, [2023-09-22T16:24:51.345981#32187-5700] ERROR -- : undefined method `id' for nil:NilClass

    user.group_access?(record.group.id, access)
                                   ^^^ (NoMethodError)
app/policies/ticket_policy.rb:87:in `agent_access?'
app/policies/ticket_policy.rb:57:in `agent_update_access?'
app/models/core_workflow/custom/ticket_time_accounting_check.rb:21:in `available_for_user?'
app/models/core_workflow/custom/ticket_time_accounting_check.rb:17:in `enabled?'
app/models/core_workflow/custom/ticket_time_accounting_check.rb:5:in `saved_attribute_match?'
app/models/core_workflow/condition/match_all_modules.rb:13:in `block (2 levels) in match'
app/models/core_workflow/condition/match_all_modules.rb:10:in `each'

Expected behaviour

No errors

Steps to reproduce the behaviour

Select empty group on support instance.

Support Ticket

No response

I'm sure this is a bug and no feature request or a general question.

yes

@rolfschmidt
Copy link
Collaborator Author

TicketPolicy.new(current_user, selected).agent_update_access? should be done the with saved ticket.

selected.persisted? && TicketPolicy.new(current_user, selected).agent_update_access?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants