Small code cleanup.
This commit is contained in:
parent
9f204806db
commit
460182e663
10 changed files with 18 additions and 21 deletions
|
@ -685,8 +685,8 @@ class App.Sidebar extends App.Controller
|
||||||
for item in @items
|
for item in @items
|
||||||
area = localEl.filter('.sidebar[data-tab="' + item.name + '"]')
|
area = localEl.filter('.sidebar[data-tab="' + item.name + '"]')
|
||||||
if item.callback
|
if item.callback
|
||||||
item.callback( area.find('.sidebar-content') )
|
item.callback(area.find('.sidebar-content'))
|
||||||
if item.actions
|
if !_.isEmpty(item.actions)
|
||||||
new App.ActionRow(
|
new App.ActionRow(
|
||||||
el: area.find('.js-actions')
|
el: area.find('.js-actions')
|
||||||
items: item.actions
|
items: item.actions
|
||||||
|
|
|
@ -71,7 +71,7 @@ class TwitterReply
|
||||||
exclude = true
|
exclude = true
|
||||||
|
|
||||||
# exclude own screen_name
|
# exclude own screen_name
|
||||||
if recipientScreenName is "@#{@ticket.preferences.channel_screen_name}".toLowerCase()
|
if recipientScreenName is "@#{ticket.preferences.channel_screen_name}".toLowerCase()
|
||||||
exclude = true
|
exclude = true
|
||||||
|
|
||||||
if exclude is false
|
if exclude is false
|
||||||
|
|
|
@ -70,6 +70,7 @@ class App.TicketStats extends App.Controller
|
||||||
render: (data) =>
|
render: (data) =>
|
||||||
if !data
|
if !data
|
||||||
data = @data
|
data = @data
|
||||||
|
return if !data
|
||||||
|
|
||||||
user_total = 0
|
user_total = 0
|
||||||
if data.user.open_ids && data.user.closed_ids
|
if data.user.open_ids && data.user.closed_ids
|
||||||
|
|
|
@ -40,7 +40,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
|
||||||
if channel.status_in == 'error'
|
if channel.status_in == 'error'
|
||||||
message = "Channel: #{channel.area} in "
|
message = "Channel: #{channel.area} in "
|
||||||
%w(host user uid).each do |key|
|
%w(host user uid).each do |key|
|
||||||
next if !channel.options[key] || channel.options[key].empty?
|
next if channel.options[key].blank?
|
||||||
message += "key:#{channel.options[key]};"
|
message += "key:#{channel.options[key]};"
|
||||||
end
|
end
|
||||||
issues.push "#{message} #{channel.last_log_in}"
|
issues.push "#{message} #{channel.last_log_in}"
|
||||||
|
@ -53,7 +53,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
|
||||||
next if channel.status_out != 'error'
|
next if channel.status_out != 'error'
|
||||||
message = "Channel: #{channel.area} out "
|
message = "Channel: #{channel.area} out "
|
||||||
%w(host user uid).each do |key|
|
%w(host user uid).each do |key|
|
||||||
next if !channel.options[key] || channel.options[key].empty?
|
next if channel.options[key].blank?
|
||||||
message += "key:#{channel.options[key]};"
|
message += "key:#{channel.options[key]};"
|
||||||
end
|
end
|
||||||
issues.push "#{message} #{channel.last_log_out}"
|
issues.push "#{message} #{channel.last_log_out}"
|
||||||
|
@ -89,7 +89,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
|
||||||
|
|
||||||
token = Setting.get('monitoring_token')
|
token = Setting.get('monitoring_token')
|
||||||
|
|
||||||
if issues.empty?
|
if issues.blank?
|
||||||
result = {
|
result = {
|
||||||
healthy: true,
|
healthy: true,
|
||||||
message: 'success',
|
message: 'success',
|
||||||
|
|
|
@ -45,10 +45,10 @@ class UserAccessTokenController < ApplicationController
|
||||||
if Setting.get('api_token_access') == false
|
if Setting.get('api_token_access') == false
|
||||||
raise Exceptions::UnprocessableEntity, 'API token access disabled!'
|
raise Exceptions::UnprocessableEntity, 'API token access disabled!'
|
||||||
end
|
end
|
||||||
if params[:label].empty?
|
if params[:label].blank?
|
||||||
raise Exceptions::UnprocessableEntity, 'Need label!'
|
raise Exceptions::UnprocessableEntity, 'Need label!'
|
||||||
end
|
end
|
||||||
token = Token.create(
|
token = Token.create!(
|
||||||
action: 'api',
|
action: 'api',
|
||||||
label: params[:label],
|
label: params[:label],
|
||||||
persistent: true,
|
persistent: true,
|
||||||
|
@ -66,7 +66,7 @@ class UserAccessTokenController < ApplicationController
|
||||||
def destroy
|
def destroy
|
||||||
token = Token.find_by(action: 'api', user_id: current_user.id, id: params[:id])
|
token = Token.find_by(action: 'api', user_id: current_user.id, id: params[:id])
|
||||||
raise Exceptions::UnprocessableEntity, 'Unable to find api token!' if !token
|
raise Exceptions::UnprocessableEntity, 'Unable to find api token!' if !token
|
||||||
token.destroy
|
token.destroy!
|
||||||
render json: {}, status: :ok
|
render json: {}, status: :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -615,10 +615,10 @@ returns
|
||||||
if channel[:group_id]
|
if channel[:group_id]
|
||||||
group = Group.lookup(id: channel[:group_id])
|
group = Group.lookup(id: channel[:group_id])
|
||||||
end
|
end
|
||||||
if !group || group && !group.active
|
if group.blank? || group.active == false
|
||||||
group = Group.where(active: true).order('id ASC').first
|
group = Group.where(active: true).order('id ASC').first
|
||||||
end
|
end
|
||||||
if !group
|
if group.blank?
|
||||||
group = Group.first
|
group = Group.first
|
||||||
end
|
end
|
||||||
title = mail[:subject]
|
title = mail[:subject]
|
||||||
|
|
|
@ -44,7 +44,7 @@ returns:
|
||||||
logger.error "File #{file['location']} is different"
|
logger.error "File #{file['location']} is different"
|
||||||
issues[file['location']] = 'changed'
|
issues[file['location']] = 'changed'
|
||||||
end
|
end
|
||||||
return nil if issues.empty?
|
return nil if issues.blank?
|
||||||
issues
|
issues
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1031,9 +1031,7 @@ perform changes on ticket
|
||||||
if key == 'ticket.action'
|
if key == 'ticket.action'
|
||||||
next if value['value'].blank?
|
next if value['value'].blank?
|
||||||
next if value['value'] != 'delete'
|
next if value['value'] != 'delete'
|
||||||
|
destroy!
|
||||||
destroy
|
|
||||||
|
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ module Enrichment
|
||||||
def synced?
|
def synced?
|
||||||
return false if !@config
|
return false if !@config
|
||||||
|
|
||||||
# TODO
|
|
||||||
UserInfo.current_user_id = 1
|
UserInfo.current_user_id = 1
|
||||||
|
|
||||||
return false if !mapping?
|
return false if !mapping?
|
||||||
|
@ -74,7 +73,7 @@ module Enrichment
|
||||||
return false if @user.organization_id
|
return false if @user.organization_id
|
||||||
|
|
||||||
# can't create organization without name
|
# can't create organization without name
|
||||||
return false if @current_changes[:name].empty?
|
return false if @current_changes[:name].blank?
|
||||||
|
|
||||||
organization = create_current
|
organization = create_current
|
||||||
|
|
||||||
|
@ -95,7 +94,7 @@ module Enrichment
|
||||||
object: organization,
|
object: organization,
|
||||||
current_changes: @current_changes,
|
current_changes: @current_changes,
|
||||||
)
|
)
|
||||||
organization.save
|
organization.save!
|
||||||
|
|
||||||
ExternalSync.create(
|
ExternalSync.create(
|
||||||
source: @source,
|
source: @source,
|
||||||
|
@ -127,10 +126,10 @@ module Enrichment
|
||||||
)
|
)
|
||||||
|
|
||||||
organization.updated_by_id = 1
|
organization.updated_by_id = 1
|
||||||
organization.save
|
organization.save!
|
||||||
|
|
||||||
@external_organization.last_payload = @payload
|
@external_organization.last_payload = @payload
|
||||||
@external_organization.save
|
@external_organization.save!
|
||||||
|
|
||||||
organization
|
organization
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,6 @@ module Enrichment
|
||||||
return false if !@config
|
return false if !@config
|
||||||
return false if @local_user.email.blank?
|
return false if @local_user.email.blank?
|
||||||
|
|
||||||
# TODO
|
|
||||||
UserInfo.current_user_id = 1
|
UserInfo.current_user_id = 1
|
||||||
|
|
||||||
return false if !mapping?
|
return false if !mapping?
|
||||||
|
|
Loading…
Reference in a new issue