Small memory footprint improvements.

This commit is contained in:
Martin Edenhofer 2019-04-07 07:46:29 +02:00
parent 13854f7fa7
commit 57b17f7b81
3 changed files with 7 additions and 7 deletions

View file

@ -30,8 +30,8 @@ class App.Ticket extends App.Model
"#ticket/zoom/#{@id}" "#ticket/zoom/#{@id}"
getState: -> getState: ->
type = App.TicketState.find(@state_id) type = App.TicketState.findNative(@state_id)
stateType = App.TicketStateType.find(type.state_type_id) stateType = App.TicketStateType.findNative(type.state_type_id)
state = 'closed' state = 'closed'
if stateType.name is 'new' || stateType.name is 'open' if stateType.name is 'new' || stateType.name is 'open'
state = 'open' state = 'open'
@ -56,8 +56,8 @@ class App.Ticket extends App.Model
@getState() @getState()
iconTitle: -> iconTitle: ->
type = App.TicketState.find(@state_id) type = App.TicketState.findNative(@state_id)
stateType = App.TicketStateType.find(type.state_type_id) stateType = App.TicketStateType.findNative(type.state_type_id)
if stateType.name is 'pending reminder' && @pending_time && new Date( Date.parse(@pending_time) ) < new Date if stateType.name is 'pending reminder' && @pending_time && new Date( Date.parse(@pending_time) ) < new Date
return "#{App.i18n.translateInline(type.displayName())} - #{App.i18n.translateInline('reached')}" return "#{App.i18n.translateInline(type.displayName())} - #{App.i18n.translateInline('reached')}"
if @escalation_at && new Date( Date.parse(@escalation_at) ) < new Date if @escalation_at && new Date( Date.parse(@escalation_at) ) < new Date

View file

@ -28,14 +28,14 @@ class App.TicketArticle extends App.Model
if @subject if @subject
return @subject return @subject
if App.Ticket.exists(@ticket_id) if App.Ticket.exists(@ticket_id)
ticket = App.Ticket.find(@ticket_id) ticket = App.Ticket.findNative(@ticket_id)
if ticket if ticket
return ticket.title return ticket.title
'???' '???'
iconActivity: (user) -> iconActivity: (user) ->
return if !user return if !user
ticket = App.Ticket.find(@ticket_id) ticket = App.Ticket.findNative(@ticket_id)
if ticket.owner_id == user.id if ticket.owner_id == user.id
return 'important' return 'important'
'' ''

View file

@ -279,7 +279,7 @@ class App.User extends App.Model
if user_role_ids if user_role_ids
for role_id in user_role_ids for role_id in user_role_ids
if App.Role.exists(role_id) if App.Role.exists(role_id)
role = App.Role.find(role_id) role = App.Role.findNative(role_id)
if role.group_ids if role.group_ids
for local_group_id, local_permission of role.group_ids for local_group_id, local_permission of role.group_ids
if _.include(local_permission, permission) || _.include(local_permission, 'full') if _.include(local_permission, permission) || _.include(local_permission, 'full')