Skip to content

Commit

Permalink
Follow up 189ccb2 - Fixes zammad#3827 - Remove ticket create screen j…
Browse files Browse the repository at this point in the history
…ob because it is not needed anymore dropdown data will get updated on action by core workflow.
  • Loading branch information
rolfschmidt committed Nov 3, 2021
1 parent 71d6b9e commit 52aa34b
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 553 deletions.
19 changes: 2 additions & 17 deletions app/assets/javascripts/app/controllers/agent_ticket_create.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ class App.TicketCreate extends App.Controller
if @ticket_id && @article_id
@split = "/#{@ticket_id}/#{@article_id}"

load = (data) =>
App.Collection.loadAssets(data.assets)
@formMeta = data.form_meta
@buildScreen(params)
@bindId = App.TicketCreateCollection.bind(load, false)
App.TicketCreateCollection.fetch()
@buildScreen(params)

# rerender view, e. g. on langauge change
@controllerBind('ui:rerender', =>
Expand All @@ -70,9 +65,6 @@ class App.TicketCreate extends App.Controller
@sidebarWidget.render(@params())
)

release: =>
App.TicketCreateCollection.unbindById(@bindId)

currentChannel: =>
if !type
type = @$('.type-tabs .tab.active').data('type')
Expand Down Expand Up @@ -280,7 +272,6 @@ class App.TicketCreate extends App.Controller
localeRender = =>
@render(template)
App.QueueManager.add(@queueKey, localeRender)
return if !@formMeta
App.QueueManager.run(@queueKey)

updateTaskManagerAttachments: (attribute, attachments) =>
Expand All @@ -291,7 +282,7 @@ class App.TicketCreate extends App.Controller
App.TaskManager.update(@taskKey, taskData)

render: (template = {}) ->
return if !@formMeta

# get params
params = @prefilledParams || {}
if template && !_.isEmpty(template.options)
Expand Down Expand Up @@ -340,8 +331,6 @@ class App.TicketCreate extends App.Controller
model: App.Ticket
screen: 'create_middle'
handlersConfig: handlers
filter: @formMeta.filter
formMeta: @formMeta
params: params
noFieldset: true
taskKey: @taskKey
Expand Down Expand Up @@ -369,8 +358,6 @@ class App.TicketCreate extends App.Controller
events:
'change [name=customer_id]': @localUserInfo
handlersConfig: handlersTunnel
filter: @formMeta.filter
formMeta: @formMeta
autofocus: true
params: params
taskKey: @taskKey
Expand All @@ -395,8 +382,6 @@ class App.TicketCreate extends App.Controller
model: App.Ticket
screen: 'create_bottom'
handlersConfig: handlersTunnel
filter: @formMeta.filter
formMeta: @formMeta
params: params
taskKey: @taskKey
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ class CustomerTicketCreate extends App.ControllerAppContent
@form_id = App.ControllerForm.formId()

@navupdate '#customer_ticket_new'

load = (data) =>
App.Collection.loadAssets(data.assets)
@formMeta = data.form_meta
@render()
@bindId = App.TicketCreateCollection.bind(load, false)
App.TicketCreateCollection.fetch()
@render()

render: (template = {}) ->
if !@Config.get('customer_ticket_create')
Expand All @@ -43,8 +37,6 @@ class CustomerTicketCreate extends App.ControllerAppContent
form_id: @form_id
model: App.Ticket
screen: 'create_middle'
filter: @formMeta.filter
formMeta: @formMeta
params: defaults
noFieldset: true
handlersConfig: handlers
Expand All @@ -70,8 +62,6 @@ class CustomerTicketCreate extends App.ControllerAppContent
model: App.Ticket
screen: 'create_top'
handlersConfig: handlersTunnel
filter: @formMeta.filter
formMeta: @formMeta
autofocus: true
params: defaults
)
Expand All @@ -83,8 +73,6 @@ class CustomerTicketCreate extends App.ControllerAppContent
events:
'fileUploadStart .richtext': => @submitDisable()
'fileUploadStop .richtext': => @submitEnable()
filter: @formMeta.filter
formMeta: @formMeta
params: defaults
handlersConfig: handlersTunnel
)
Expand All @@ -95,8 +83,6 @@ class CustomerTicketCreate extends App.ControllerAppContent
model: App.Ticket
screen: 'create_bottom'
handlersConfig: handlersTunnel
filter: @formMeta.filter
formMeta: @formMeta
params: defaults
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ class App.FormHandlerCoreWorkflow
return if !App.WebSocket.channel()
return !App.Config.get('core_workflow_ajax_mode')

@restrictValuesAttributeCache: (attribute, values) ->
result = { values: values }
return result if !attribute.relation
result.lastUpdatedAt = App[attribute.relation].lastUpdatedAt()
return result

# restricts the dropdown and tree select values of a form
@restrictValues: (classname, form, ui, attributes, params, data) ->
return if _.isEmpty(data.restrict_values)
Expand Down Expand Up @@ -111,11 +117,11 @@ class App.FormHandlerCoreWorkflow
# cache state for performance and only run
# if values or param differ
if coreWorkflowRestrictions?[classname]?[item.name]
compare = values
compare = App.FormHandlerCoreWorkflow.restrictValuesAttributeCache(attribute, values)
continue if _.isEqual(coreWorkflowRestrictions[classname][item.name], compare)

coreWorkflowRestrictions[classname] ||= {}
coreWorkflowRestrictions[classname][item.name] = values
coreWorkflowRestrictions[classname][item.name] = App.FormHandlerCoreWorkflow.restrictValuesAttributeCache(attribute, values)

valueFound = false
for value in values
Expand Down

This file was deleted.

31 changes: 0 additions & 31 deletions app/jobs/ticket_create_screen_job.rb

This file was deleted.

1 change: 0 additions & 1 deletion app/models/concerns/has_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ def flush_group_access_buffer
yield
self.group_access_buffer = nil
cache_delete
push_ticket_create_screen_background_job
end

def process_group_access_buffer
Expand Down
13 changes: 2 additions & 11 deletions app/models/concerns/has_roles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module HasRoles
included do
has_and_belongs_to_many :roles,
before_add: %i[validate_agent_limit_by_role validate_roles],
after_add: %i[cache_update check_notifications push_ticket_create_screen_for_role_change],
after_add: %i[cache_update check_notifications],
before_remove: :last_admin_check_by_role,
after_remove: %i[cache_update push_ticket_create_screen_for_role_change]
after_remove: %i[cache_update]
end

# Checks a given Group( ID) for given access(es) for the instance associated roles.
Expand Down Expand Up @@ -45,15 +45,6 @@ def role_access?(group_id, access)
)
end

def push_ticket_create_screen_for_role_change(role)
return if Setting.get('import_mode')

permission = Permission.lookup(name: 'ticket.agent')
return if !role.permissions.exists?(id: permission.id)

push_ticket_create_screen_background_job
end

# methods defined here are going to extend the class, not the instance of it
class_methods do

Expand Down
28 changes: 0 additions & 28 deletions app/models/concerns/has_ticket_create_screen_impact.rb

This file was deleted.

1 change: 0 additions & 1 deletion app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Group < ApplicationModel
include HasHistory
include HasObjectManagerAttributes
include HasCollectionUpdate
include HasTicketCreateScreenImpact
include HasSearchIndexBackend

include Group::Assets
Expand Down
1 change: 0 additions & 1 deletion app/models/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class Role < ApplicationModel
include ChecksLatestChangeObserved
include HasGroups
include HasCollectionUpdate
include HasTicketCreateScreenImpact

include Role::Assets

Expand Down
2 changes: 0 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ class User < ApplicationModel
include HasGroups
include HasRoles
include HasObjectManagerAttributes
include ::HasTicketCreateScreenImpact
include HasTaskbars
include User::HasTicketCreateScreenImpact
include User::Assets
include User::Avatar
include User::Search
Expand Down
14 changes: 0 additions & 14 deletions app/models/user/has_ticket_create_screen_impact.rb

This file was deleted.

Loading

0 comments on commit 52aa34b

Please sign in to comment.